Open lazarte opened 7 years ago
That's a pretty straightforward error. You shouldn't be trying to send something before the connect event is fired. But are you actually connecting to a socket.io server?
Yes I'm connecting to the primus with socket.io transformer. I got an message from the server so meaning the handshake is successful?
That got message doesn't look like something socket.io would send. The first thing socket.io should be sending is a connect packet that has some connection information.
Actually that message emit from our server. Manually added this code from this pull request 489 seems to trigger the connect event?
Are you sure that you're not looking for a straight Websocket client? Because if you're changing to so much that it isn't getting the proper packets to connect you're getting into fork land.
@nuclearace below is the code for the primus server don't know why the client doesn't trigger the connect event. On the other hand using socket.io works fine. But want to know why its not working with the primus.
var Primus = require('primus') var primus = Primus.createServer({ port: 3002, transformer: 'websockets' }); primus.on('connection', function (spark) { spark.write({"type":0,"data":["@HandShake","Hello"]}); });
Does primus
follow the socket.io protocol? Because that's the only way this client would work with it.
Hi, I successfully setup the SocketIOClient and this seems to be that that the server replied when I connect. But the client doesn't receive response that it was connected. When trying to emit will give me the error that it was not connected. See below codes and logs. Please help.
LOG SocketIOClient: Adding handler for event: connect LOG SocketIOClient: Adding engine LOG SocketEngine: Starting engine. Server: SOCKET_URL LOG SocketEngine: Handshaking LOG SocketEngine: Got message: {"type":0,"data":["@HandShake","Hello"]} // Replied from the server LOG SocketIOClient: Handling event: error with data: ["Tried emitting data when not connected"] Any Got event: error, with items: Optional(["Tried emitting data when not connected"])