Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict with qaap/rpc-websockets #604

Closed
ulion opened this issue Aug 14, 2017 · 7 comments
Closed

Conflict with qaap/rpc-websockets #604

ulion opened this issue Aug 14, 2017 · 7 comments

Comments

@ulion
Copy link

ulion commented Aug 14, 2017

Version:
npm newest

Environment:

  • Operating system:
    OSX EL Caption
  • Browser:
    N/A
  • Node.js:
    v6.11.1

Expected result:
Work as use primus only

Actual result:
Report timeout then reconnect and keep failing (it reported that, but indeed the connection looks ok by checking the real network connection)

Steps to reproduce:
import qaap/rpc-websockets into the same node app, and probably also use qaap/rpc-websockets to connect to somewhere, then the original primus working code will report failure because of some hidden conflict.

@lpinca
Copy link
Member

lpinca commented Aug 15, 2017

Are you using Primus to connect to a plain WebSocket server? If so, you have to take into account:

  • The heartbeats. The Primus client expects ping messages to be sent by the server. If no ping is received the connection gets closed.
  • The parser. You must ensure that messages are encoded/decoded with the same parser used by Primus.

@ulion
Copy link
Author

ulion commented Aug 15, 2017

Yes, I use it with a plain websocket server.

is there a way to turn off the heartbeats?

and I do use json parser, so this is not the problem.

but the case I encountered is not in above 2 cases, it's clearly if I import rpc-websockets (which uses uws in its implement), the primus will fail to connect. else it has no problem.

@ulion
Copy link
Author

ulion commented Aug 15, 2017

it's in a complex app, I tried, but failed to reproduce it with a simple short code. what I can tell, in my env, if I does included rpc-websockets, even does not really call the Websocket (of rpc-websockets), it will cause primus failure. and if I comment out the require line of importing rpc-websockets, the primus will works.

@lpinca
Copy link
Member

lpinca commented Aug 15, 2017

Heartbeats can be disabled by setting the pingInterval option to false. You have to rebuild the client for changes to take effect.

What I can suggest is to start a plain uws server, build the Primus client using the websockets transformer and use it to connect to the uws server to see if the connection can be established.

@ulion
Copy link
Author

ulion commented Aug 15, 2017 via email

@lpinca
Copy link
Member

lpinca commented Aug 15, 2017

either websockets or uws as transformer results same.

Yes this is expected as the uws transformer uses the websockets transformer as client.
Anyway this is odd as all tests pass and the uws transformer just starts a plain uws server. The only difference is that we are using the native interface.

@ulion
Copy link
Author

ulion commented Aug 18, 2017

which indicated that I used wrong url in the case, sorry for the noise.

@ulion ulion closed this as completed Aug 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants