taoensso / sente

Realtime web comms library for Clojure/Script
https://www.taoensso.com/sente
Eclipse Public License 1.0
1.74k stars 193 forks source link

Connecting with Java clients? #282

Closed julienfantin closed 7 years ago

julienfantin commented 7 years ago

Our sente server works great with using sente as the client in cljs.

However we're trying to connect with a Java client for load testing, and I've been unable to make it work.

I can get a connection upgrade over HTTP with curl, using something like:

curl -i -N \
     -H "Connection:Upgrade" \
     -H "Sec-WebSocket-Key: rk6KDgfg0GWCih5G/XRiDg==" \
     -H "Sec-WebSocket-Version: 13" \
     -H "Upgrade: websocket" \
     -H "Host: localhost:8080" \
     -H "Origin: http://localhost:8080" \
     http://localhost:8080/websocket?client-id=fc391090-eb82-4585-91fa-7010d70685ba

However on the Java side, it seems all the clients I've tried only accept a ws:// url, but those connections don't seem to reach our backend at all.

I'm confused whether this is an issue with the sente adapters requiring a full upgrade over http which those clients don't seem to support, or maybe more simply a configuration issue on our backend in order to handle the ws scheme?

julienfantin commented 7 years ago

Issue was on me, just in case anyone runs into this, running immutant as a backend, you'll want the server to bind to localhost rather than 0.0.0.0 since the latter will somehow make the service available to ipv6 clients only.