Crash when server returns a disconnect response
dmorgereth opened this issue · comments
Our rails server occasionally returns the following response
{"type":"disconnect","reason":"unauthorized","reconnect":false}"
This will cause the code to crash on line 112 of JSONSerializer.swift:
return Message(channelIdentifier: channelIdentifier!, // <<-- there is no "identifier" member in the response, so channelIdentfier will be nil
actionName: messageActionName,
messageType: MessageType.message,
data: messageValue,
error: messageError)
Recommend that the code be fixed to not force-unwrap channelIdentifier and treat the disconnect the same as a reject
you can try this https://github.com/nerzh/Action-Cable-Swift