1iveowl / WebsocketClientLite.PCL

Websocket client lite
MIT License
38 stars 14 forks source link

Session with SocketIO #8

Closed cmisztur closed 7 years ago

cmisztur commented 7 years ago

Hi @1iveowl.

Have you tried connecting to a SocketIO server? https://github.com/socketio/engine.io-protocol

I understand that SocketIO adds some overhead to the front of each frame, defining the packet types, which need to be parsed with a WebSocket implementation.

The current WebsocketClientLite.PCL source breaks in the HandshakeParser where the server sends a frame '0' for OPEN.

What is the best approach to support Socket.IO in your libraries? I am willing to help of course.

Thanks Chris

1iveowl commented 7 years ago

Not sure. I've only tested this library with wss://echo.websocket.org (Echo Test) and this seeems to work according to the Websocket specification.

If you want to help you can either download the code here and try and debug it youself or you can point me to a running server that uses SocketIO somewhere on the internet and I'll have a look at the debugging myself?

1iveowl commented 7 years ago

So I looked into it some more and my understanding is that a WebSocket Client can't really talk to a Socket.IO server. See this Stack Overflow post: Connect to Socket.io server with standard web-socket client

I also tried installing a SocketIO Server from this example: Get Started: Chat application and what fails is that when the Websocket library tries to connect to the Socket IO server, the Socket IO Server does not seem to reply. The stream I see coming back is zero bytes and the connection then times out.

Does this answer your question?

cmisztur commented 7 years ago

Well... your library kind of works, as well as WebSockets-sharp.

What URI did you use? You'll need something like this: ws://127.0.0.1:1338/socket.io/?EIO=2&transport=websocket

Can you try against 0.3.2 from here: http://easel.inventables.com/downloads. You will need *:* added to origins in iris.js for yourself to connect. (Not sure if origin is part of WS spec, but it would definitely help.) Before you run node iris.js give yourself some debug: set DEBUG=*,-not_this

/chris

1iveowl commented 7 years ago

Thank you. That was very helpful.

I tracked now some odd behavior related to the handshake. For some reason this issue does not present itself when using the echo.websocket.org test server but it does surface when connecting to a Socket IO server.

I've released a 3.6.1-beta NuGet version that should have fixed the issue. Please test and confirm?

cmisztur commented 7 years ago

I pulled the source, works good! Thanks.