3

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

Liviu Sosu
  • 1,381
  • 3
  • 15
  • 26
  • **SOLVED!** I finally convinced the developer of the websocket (which is written in node.js) to use another websocket library and now it works without chopping the message. **The websocket4net library works well on windows phone 8** – Liviu Sosu Oct 03 '14 at 09:21

1 Answers1

1

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

Scott Stensland
  • 26,870
  • 12
  • 93
  • 104
  • 1
    That's it! Thank you so much! Binary data may case compatibility issues. That websocket is written in javascript, and it will be consumed by various platforms like windows phone, android, iOS ... maybe more. But I will talk to my colleague to send chops of data, eventually labeled with 'chunck' and a order number, to rebuild the monster message locally. – Liviu Sosu Sep 05 '14 at 07:26