Rocher0724 / socket.io-unity

MIT License
107 stars 19 forks source link

Socket disconnects 30 seconds after connecting #5

Closed ArkinSolomon closed 3 years ago

ArkinSolomon commented 3 years ago

Hello!

This package does exactly what I need, however, it disconnects after 30 seconds, even though the server received it's connection. The event that the server sends back is very hit or miss, sometimes it works, sometimes it doesn't. Also, I have no clue how the error events work and if there are any parameter's, so I can't really debug.

Here's my client code (c#):

Screen Shot 2020-10-19 at 3 19 26 PM

And here's my server code (Node):

Screen Shot 2020-10-19 at 3 20 37 PM
ArkinSolomon commented 3 years ago

Here's the log:

2020-10-21 14:36:10 100 [1] -:#0 - ignoring socket cache for http://domain.com:63053/
2020-10-21 14:36:10 102 [1] -:#0 - Init Manager: http://domain.com:63053/
2020-10-21 14:36:10 104 [1] -:#0 - readyState CLOSED
2020-10-21 14:36:10 104 [1] -:#0 - opening http://domain.com:63053/
2020-10-21 14:36:10 117 [1] -:#0 - SetTransport setting transport 'polling'
2020-10-21 14:36:10 117 [150] -:#0 - Task.Run Open start
2020-10-21 14:36:10 118 [150] -:#0 - xhr DoPoll
2020-10-21 14:36:10 121 [150] -:#0 - xhr open GET: http://domain.com:63053/socket.io/?EIO=3&transport=polling&t=637388877701192200-0&b64=1
2020-10-21 14:36:10 122 [139] -:#0 - Task.Run Create start
2020-10-21 14:36:10 152 [139] -:#0 - Xhr.GetResponse 
2020-10-21 14:36:10 156 [139] -:#0 - OnData string = 96:0{"sid":"T5tRCN0GDOEQL33BAAAF","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}2:40
2020-10-21 14:36:10 157 [139] -:#0 - polling got data 96:0{"sid":"T5tRCN0GDOEQL33BAAAF","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}2:40
2020-10-21 14:36:10 164 [139] -:#0 - Writable: True sid=
2020-10-21 14:36:10 165 [139] -:#0 - socket received: type 'open', data '{"sid":"T5tRCN0GDOEQL33BAAAF","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}'
2020-10-21 14:36:10 185 [139] -:#0 - OnHandshake
2020-10-21 14:36:10 188 [139] -:#0 - ReadyState=OPEN Transport.Writeable=True Upgrading=False WriteBuffer.Count=0
2020-10-21 14:36:10 188 [139] -:#0 - Flush Not Send
2020-10-21 14:36:10 189 [139] -:#0 - open
2020-10-21 14:36:10 191 [139] -:#0 - OnOpen starting upgrade probes
2020-10-21 14:36:10 192 [139] -:#0 - Probe probing transport 'websocket'
2020-10-21 14:36:10 195 [139] -:#0 - DoOpen uri =ws://domain.com:63053/socket.io/?EIO=3&transport=websocket&sid=T5tRCN0GDOEQL33BAAAF&t=637388877701956110-1
2020-10-21 14:36:10 204 [139] -:#0 - socket received: type 'message', data '0'
2020-10-21 14:36:10 205 [139] -:#0 - decoded 0 as Type:0 Id:-1 Nsp:/ Data: Attachments:0
2020-10-21 14:36:10 215 [139] -:#0 - writing packet Type:2 Id:-1 Nsp:/ Data:[
  "link",
  "213a186c-b716-4189-bd64-057c903dcd49"
] Attachments:0
2020-10-21 14:36:10 215 [139] -:#0 - encoding packet Type:2 Id:-1 Nsp:/ Data:[
  "link",
  "213a186c-b716-4189-bd64-057c903dcd49"
] Attachments:0
2020-10-21 14:36:10 215 [139] -:#0 - encoded Type:2 Id:-1 Nsp:/ Data:[
  "link",
  "213a186c-b716-4189-bd64-057c903dcd49"
] Attachments:0 as 2[
  "link",
  "213a186c-b716-4189-bd64-057c903dcd49"
]
2020-10-21 14:36:10 216 [139] -:#0 - ReadyState=OPEN Transport.Writeable=True Upgrading=False WriteBuffer.Count=1
2020-10-21 14:36:10 216 [139] -:#0 - Flush 1 packets in socket
2020-10-21 14:36:10 216 [139] -:#0 - Send called with packets.Count: 1
2020-10-21 14:36:10 216 [139] -:#0 - Write packets.Count = 1
2020-10-21 14:36:10 216 [139] -:#0 - Writable: False sid=T5tRCN0GDOEQL33BAAAF
2020-10-21 14:36:10 222 [139] -:#0 - DoWrite data = System.Byte[]
2020-10-21 14:36:10 222 [139] -:#0 - xhr open POST: http://domain.com:63053/socket.io/?EIO=3&transport=polling&sid=T5tRCN0GDOEQL33BAAAF&t=637388877702224860-3&b64=1
2020-10-21 14:36:10 229 [154] -:#0 - Task.Run Create start
2020-10-21 14:36:10 254 [154] -:#0 - Xhr.GetResponse 
2020-10-21 14:36:10 255 [154] -:#0 - OnData string = ok
2020-10-21 14:36:10 255 [155] -:#0 - ws_Opened True
2020-10-21 14:36:10 255 [155] -:#0 - Writable: True sid=T5tRCN0GDOEQL33BAAAF
2020-10-21 14:36:10 255 [154] -:#0 - Writable: True sid=T5tRCN0GDOEQL33BAAAF
2020-10-21 14:36:10 256 [155] -:#0 - Send called with packets.Count: 1
2020-10-21 14:36:10 257 [155] -:#0 - Writable: False sid=T5tRCN0GDOEQL33BAAAF
2020-10-21 14:36:10 257 [154] -:#0 - Task.Run Create finish
2020-10-21 14:36:10 258 [139] -:#0 - ReadyState != ReadyStateEnum.CLOSED
2020-10-21 14:36:10 258 [139] -:#0 - xhr DoPoll
2020-10-21 14:36:10 258 [155] -:#0 - Writable: True sid=T5tRCN0GDOEQL33BAAAF
2020-10-21 14:36:10 258 [139] -:#0 - xhr open GET: http://domain.com:63053/socket.io/?EIO=3&transport=polling&sid=T5tRCN0GDOEQL33BAAAF&t=637388877702583480-4&b64=1
2020-10-21 14:36:10 258 [118] -:#0 - Task.Run Create start
2020-10-21 14:36:10 273 [119] -:#0 - ws_MessageReceived e.Message= 3probe
2020-10-21 14:36:10 280 [118] -:#0 - Xhr.GetResponse 
2020-10-21 14:36:10 280 [118] -:#0 - OnData string = 11:42["start"]
2020-10-21 14:36:10 280 [118] -:#0 - polling got data 11:42["start"]
2020-10-21 14:36:10 280 [118] -:#0 - socket received: type 'message', data '2["start"]'
2020-10-21 14:36:10 280 [118] -:#0 - decoded 2["start"] as Type:2 Id:-1 Nsp:/ Data:["start"] Attachments:0
2020-10-21 14:36:10 281 [118] -:#0 - emitting event System.Collections.Generic.List`1[System.Object]
2020-10-21 14:36:20 329 [119] -:#0 - ws_Closed
2020-10-21 14:36:20 330 [119] -:#0 - Transport.OnClose()
2020-10-21 14:36:20 331 [119] -:#0 - probe transport "websocket" failed because of error: transport closed
2020-10-21 14:36:35 207 [149] -:#0 - writing ping packet - expecting pong within 5000ms, ReadyState = OPEN
2020-10-21 14:36:35 209 [149] -:#0 - ReadyState=OPEN Transport.Writeable=True Upgrading=True WriteBuffer.Count=1
2020-10-21 14:36:35 209 [149] -:#0 - Flush Not Send
2020-10-21 14:36:40 212 [149] -:#0 - EasyTimer OnHeartbeat start
2020-10-21 14:36:40 214 [149] -:#0 - OnClose socket close with reason: ping timeout
2020-10-21 14:36:40 215 [149] -:#0 - Socket.ReadyState = CLOSE
2020-10-21 14:36:40 216 [149] -:#0 - start
2020-10-21 14:36:40 217 [149] -:#0 - close (ping timeout)
ArkinSolomon commented 3 years ago

Also, I'm using Unity 2020.1.4f1 and Node 14.9.0

ArkinSolomon commented 3 years ago

It's been a month, it looked promising but I shall move on and find another package or make my own.

Megamil commented 3 years ago

managed to find any other, friend?

ArkinSolomon commented 3 years ago

Yeah I did, I used https://github.com/doghappy/socket.io-client-csharp.