danielrhodes / Swift-ActionCableClient

ActionCable is a new WebSocket server being released with Rails 5 which makes it easy to add real-time features to your app. This Swift client makes it dead-simple to connect with that server, abstracting away everything except what you need to get going.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSON decoding error for ping in v0.1.5

kh0r opened this issue · comments

Since version v0.1.5 the ping message fails JSON decoding with:
[ActionCableClient] Error decoding message: Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0." UserInfo={NSDebugDescription=Invalid value around character 0.}

Also for 0.1.4.

Reverting to 0.1.3 fixed it for me

What version of Rails are you on?

In the last release I removed SwiftyJSON as a dependency. Will investigate.

On Jun 23, 2016, at 01:04, Markus Klepp notifications@github.com wrote:

Since version v0.1.5 the ping message fails JSON decoding with:
[ActionCableClient] Error decoding message: Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0." UserInfo={NSDebugDescription=Invalid value around character 0.}


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

This could be the issue. My backend guy is using an older version of actioncable. The raw ping message looks like this:
{"identifier":"_ping","message":1466618952}

It looks like the underscore in the identifier has been removed:
old version:
https://github.com/danielrhodes/Swift-ActionCableClient/blob/v0.1.3/Pod/Classes/Constants.swift#L53
new version:
https://github.com/danielrhodes/Swift-ActionCableClient/blob/v0.1.5/Pod/Classes/Constants.swift#L56

Thanks

In RC1 of Rails there is support for versioning of the underlying ActionCable protocol so that these kinds of issues can be avoided more elegantly in the future.

I will need to switch out the underlying WebSocket library to support that though as Starscream does not support it.