triniwiz / nativescript-socketio

Socket.IO for nativescript
Apache License 2.0
71 stars 31 forks source link

IOS emitting JSON Objects #14

Closed donburgess closed 7 years ago

donburgess commented 8 years ago

Be aware that JSON objects will crash your application when trying to send through IOS.

This is because the data is not being marshalled to an NSDictionary object at this time. One of many work arounds is to JSON.stringify() your data before emitting.

noomieware commented 8 years ago

Hi.

It seems this is still as described. While working on android with real JSON objects, IOS app is crashing as soon as I try to emit an object to my server and the server is not being requested. If I stringify that object, I can see, that the request is passed to the server and app is not crashing. However, the response from the server, which is also JSON is not handled correctly in the client too.

This is an issue, as this requires the server to handle strings and real objects.

triniwiz commented 8 years ago

@noomieware soon this will be fixed in about a week or two currently waiting on the apple event before i purchase a macbook

noomieware commented 8 years ago

@triniwiz thx, don't hesitate to ask, if I can help out (e.g. testing)

donburgess commented 7 years ago

@noomieware It is actually best practice to send data encoded rather than as an object over web socket. I know it isn't a solution to your problem but just thought I'd throw that out there. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array this would be the api you'd use to convert your javascript to a byte[].

roblav96 commented 7 years ago

@db3dev Very true. Thanks mate =]