eoinsha / JavaPhoenixChannels

Java and Android channel client for the Phoenix Framework
BSD 3-Clause "New" or "Revised" License
203 stars 101 forks source link

Phoenix 1.3 - UnrecognizedPropertyException: Unrecognized field "join_ref" #58

Closed dbishai closed 7 years ago

dbishai commented 7 years ago

The join_ref field was added in Phoenix 1.3. Using a Phoenix 1.3 server with this library causes the following exception:

E/Socket: Failed to read message payload
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "join_ref" (class org.phoenixframework.channels.Envelope), not marked as ignorable (4 known properties: "event", "ref", "payload", "topic"])
                                                                      at [Source: buffer(okhttp3.internal.ws.WebSocketReader$FramedMessageSource@6881cef).inputStream(); line: 1, column: 85] (through reference chain: org.phoenixframework.channels.Envelope["join_ref"])
                                                                      at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownProperty(DeserializationContext.java:834)
                                                                      at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:1096)
                                                                      at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1469)
                                                                      at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1447)
                                                                      at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:282)
                                                                      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140)
                                                                      at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3789)
                                                                      at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2899)
                                                                      at org.phoenixframework.channels.Socket$PhoenixWSListener.onMessage(Socket.java:80)
                                                                      at okhttp3.internal.ws.RealWebSocket$1.onMessage(RealWebSocket.java:62)
                                                                      at okhttp3.internal.ws.WebSocketReader.readMessageFrame(WebSocketReader.java:242)
                                                                      at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.java:108)
                                                                      at okhttp3.internal.ws.RealWebSocket.readMessage(RealWebSocket.java:97)
                                                                      at okhttp3.ws.WebSocketCall.createWebSocket(WebSocketCall.java:152)
                                                                      at okhttp3.ws.WebSocketCall.access$000(WebSocketCall.java:41)
                                                                      at okhttp3.ws.WebSocketCall$1.onResponse(WebSocketCall.java:97)
                                                                      at okhttp3.RealCall$AsyncCall.execute(RealCall.java:126)
                                                                      at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
                                                                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                      at java.lang.Thread.run(Thread.java:761)
dbishai commented 7 years ago

This commit shows exactly what needs to be done to add support for version 2 of the protocol: https://github.com/phoenixframework/phoenix/commit/7e4ddf3153519a276e3ab693e1ea379675f1ed02

I've started working on porting the code however I'm sure others more familiar with the implementation could do a much better job. Is there any plan to add support or should I continue working on a pull request?

dbishai commented 7 years ago

duplicate of #56