sacOO7 / SocketclusterClientDotNet

C# client for socketcluster framework in node.js
http://socketcluster.io/#!/
Apache License 2.0
69 stars 16 forks source link

Client pong timed out #5

Closed Aeroxander closed 7 years ago

Aeroxander commented 7 years ago

So I just setup a basic socketcluster server with this C# client and javascript client but I'm getting this time out error:

[Warning] SocketProtocolError: Client pong timed out
    at Emitter.SCSocket._onSCClose (/usr/local/Tribion/Lens/socketcluster/server/node_modules/socketcluster-server/scsocket.js:207:17)
    at Timeout.<anonymous> (/usr/local/Tribion/Lens/socketcluster/server/node_modules/socketcluster-server/scsocket.js:172:10)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)
1490090617481 - Origin: Worker (PID 24541)
   [Warning] SocketProtocolError: Client pong timed out
    at Emitter.SCSocket._onSCClose (/usr/local/Tribion/Lens/socketcluster/server/node_modules/socketcluster-server/scsocket.js:207:17)
    at Timeout.<anonymous> (/usr/local/Tribion/Lens/socketcluster/server/node_modules/socketcluster-server/scsocket.js:172:10)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)
1490090625381 - Origin: Worker (PID 24541)
   [Warning] SocketProtocolError: Client pong timed out
    at Emitter.SCSocket._onSCClose (/usr/local/Tribion/Lens/socketcluster/server/node_modules/socketcluster-server/scsocket.js:207:17)
    at Timeout.<anonymous> (/usr/local/Tribion/Lens/socketcluster/server/node_modules/socketcluster-server/scsocket.js:172:10)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)

Don't know what to do with this :|

People had this with other outdated clients, is that the problem?

Anyway thanks for your great work! Other than this it's working fine :D

sacOO7 commented 7 years ago

Which version of socketcluster-server you are using right now? Just make sure it is latest one.

Aeroxander commented 7 years ago

5.9.0

I'm also getting Object reference not set to an instance of an object in Socket.cs line 148: id = (string) ((JObject)dataobject).GetValue("id"); but that's only sometimes when I restart and send with my client often and then sometimes it doesn't send but that could also be my fault..

sacOO7 commented 7 years ago

Ok is it working fine for now? I think that wont be creating any problem for transferring messages

sacOO7 commented 7 years ago

At the error of object reference, just try to print the instance of object and make sure it is correct, then try to cast it :)

Aeroxander commented 7 years ago

It isn't working yet, it almost looks like the server receives something that goes wrong, and gives a weird empty websocket back that gives me the object reference error. I'm trying to send a small base64 image to the javascript client, it works like 1 time and then it gives me that error or nothing.

sacOO7 commented 7 years ago

Hey you can ask the same on gitter, because I'm not the author of js client. The link is https://gitter.im/SocketCluster/socketcluster

Aeroxander commented 7 years ago

So I fixed the error by putting a thread.sleep in the mid section of my code, I guess I was doing things to fast after each other haha :D

sacOO7 commented 7 years ago

Yeah I think so :), if you want to contribute to the client, fork it, make changes and create pull request. I think its still not stable for unity :p

Aeroxander commented 7 years ago

I'd be glad to if I have some spare time! Any hints where I can improve?

sacOO7 commented 7 years ago

Can you make project ready to be get uploaded on Nuget? I think it will facilitate resolving dependencies based on variety of builds.

Aeroxander commented 7 years ago

Alright so the solution was in Socket.cs in websocket_MessageReceived to use if (e.Message.Contains("1") && !e.Message.Contains("data")) instead of e.Message == "#1". This seems to do the trick, don't know a shorter way other than converting the json to object and then checking if it's null but that gave me an error.

sacOO7 commented 7 years ago

Yeah, maybe :). Just let me know once you get it right.