Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why my websocket connection is getting closed when I receive big json messages?

I'm developing a windows phone 8 application using a web-socket from websocket4net. I send a json message and I got back a a message with a list of objects from a service. When this list is bigger (it contains more objects thus the length is bigger - more than 18157 characters) I receive the first 18157 characters of the message and the connection gets closed. And of course the json message is not valid because of its incompleteness.

I pretty sure that the large message is the problem. I tryied sending other json and it sends back another message which is also a big one. Same problem - I receive an incoplete message and the connection gets closed.

Do you have any idea what should I do to receive the full message, and the connection to remain open. The developer of the service says that his service works fine.

Thank you in advance :)

like image 461
Liviu Sosu Avatar asked Jan 21 '26 21:01

Liviu Sosu


1 Answers

web sockets handle binary data more efficiently than json text, so if you send arrays as binary it may help, also sometimes I first send a json message telling the receiver how many discrete messages I am sending so the receiver knows when it has received all msgs then you can chop the monster json into chunks of tags

like image 82
Scott Stensland Avatar answered Jan 24 '26 17:01

Scott Stensland



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!