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

1k Views Asked by At

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 :)

1

There are 1 best solutions below

1
On BEST ANSWER

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