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

Prebuilt version fails on tls handshake #534

Closed
Rubensei opened this issue Mar 3, 2021 · 7 comments
Closed

Prebuilt version fails on tls handshake #534

Rubensei opened this issue Mar 3, 2021 · 7 comments

Comments

@Rubensei
Copy link

Rubensei commented Mar 3, 2021

I'm trying to connect to a custom host from Node.js but i always get unavailable state

Pusher : : ["State changed","initialized -> connecting"]
Pusher : : ["Connecting",{"transport":"ws","url":"wss://my-domain.com:443/app/MY_APP_KEY?protocol=7&client=js&version=7.0.3&flash=false"}]
Pusher : : ["State changed","connecting -> unavailable"]

I found out that the client automatically closes the TCP session as soon as the TLS handshake finishes
No error is thrown on client and there are no logs at all on the server,
Here the wireshark capture of the tcp handshake and immediate disconnection (the ip ending in 40 corresponds to my device, being the leftmost column the destination address of the packet)
image

I've been able to connect to the same ws endpoint with the same uri using pusher-client and ws npm packages.

The code i'm using right now:

let pusher = new Pusher(APP_KEY, {
	wsHost: WS_ENDPOINT,
	forceTLS: true,
	enableStats: false,
	enabledTransports: ['ws'],
})

Using
Client

  • Pusher-js 7.0.3
  • Nodejs 14.15.5
  • Windows 10 19042.844

Server

  • Nginx with reverse proxy for ws endpoint
  • laravel-websockets
@Rubensei Rubensei changed the title TCP FIN after tls handshake Client disconnection after tls handshake Mar 5, 2021
@Rubensei
Copy link
Author

Rubensei commented Mar 5, 2021

Seems to be some issue with certificate validation similar to this. Other clients can still connect fine though

EDIT: Although this allows to connect it doesn't seem to be the issue at all

@Rubensei Rubensei closed this as completed Mar 5, 2021
@Rubensei Rubensei changed the title Client disconnection after tls handshake Unable to connect to wss using npm package Mar 5, 2021
@Rubensei
Copy link
Author

Rubensei commented Mar 5, 2021

I've been doing some more tests and i've found out that building locally and using that build allows to connect without any error

  • Cd to pusher-js folder inside node_modules and download the dependencies with yarn install
  • make build_all to build the new files

@Rubensei Rubensei reopened this Mar 5, 2021
@Rubensei Rubensei changed the title Unable to connect to wss using npm package Prebuilt version fails on tls handshake Mar 8, 2021
@benw-pusher
Copy link
Contributor

I believe the issue here is related to the setup on your websocket host.
Does the pre-built library connect ok to official Pusher clusters?

@Rubensei
Copy link
Author

Rubensei commented Mar 8, 2021

Yes, it does connect to the official clusters.

The weird thing is that I tested other ws clients like ws, pusher-client and faye-websocket and all can connect without any issue to the same endpoint using the pre-built lib. While pusher-js can't connect unless I use a locally built version (without any modification at all) as commented before.

@stale
Copy link

stale bot commented Jul 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you'd like this issue to stay open please leave a comment indicating how this issue is affecting you. Thank you.

@stale stale bot added the wontfix label Jul 21, 2021
@shehi
Copy link

shehi commented Jul 23, 2021

Better create a ticket on Pusher support, linking this issue there. Otherwise they won't look into issues.

@stale stale bot removed the wontfix label Jul 23, 2021
@benw-pusher benw-pusher added wontfix and removed Bug labels Jul 30, 2021
@stale stale bot removed the wontfix label Jul 30, 2021
@benw-pusher
Copy link
Contributor

Thanks for reporting this. We supply our client libraries for connecting to the official Pusher service and do not guarantee support for custom websocket hosts. We are not able to provide a resolution to this issue for this reason.

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

4 participants