Comments (7)
Is payload
an optional value from Phoenix? I was under the impression that it would return an empty payload if none was specified
from javaphoenixclient.
I don't know how it's specified, but our app is crashing with an NPE inside on(event: String, callback: (Message) -> Unit)
when trying in the callback
to perform the message.payload.isNotEmpty()
check, saying that the Map
instance is null.
from javaphoenixclient.
I would say you have a bug in your phoenix app. There should always be a payload at least in the form of
"payload":{"status":"ok", ...}
A message without a payload doesn't have much value to it. I will try to verify this behavior on phoenix but until then, im hesitant to make any change
from javaphoenixclient.
A message without payload still has a value. There are sometimes events which don't carry any information, apart from that the event happened (e.g. scan finished or something like this).
Also I don't insist on changing the API to make payload
nullable. I know this would break the code of existing library users.
I think the fix should rather be making sure that the non-nullable contract of this field is not broken by Gson.
from javaphoenixclient.
I might be missing something, but this test case passes while the json is missing a payload
@Test
internal fun `parses from Gson if missing payload`() {
val json = """
{"topic":"phoenix","ref":"82","event":"phx_reply"}
"""
val message = Defaults.gson.fromJson(json, Message::class.java)
assertThat(message.payload).isNotNull()
}
from javaphoenixclient.
Yes, indeed, the test passes. I don't know why at runtime on an Android device it then still returns null.
Never mind, we have found a workaround in our app. So you can close the issue.
Thanks for your support!
from javaphoenixclient.
Of course. Thanks for reaching out!
from javaphoenixclient.
Related Issues (20)
- NPE in trigger() HOT 4
- Question about the heartbeat HOT 6
- Websocket is automatically reconnected event when intentionally closed HOT 2
- Leaking bindings when the channel reply times out? HOT 3
- Lots of Timers created HOT 2
- ReconnectAfterMs is too big HOT 1
- Downgrade OKhttp to 3.12.2 HOT 1
- Heartbeat seems to be sent only once (instead of every x seconds) HOT 2
- Reconnection strategy documentation HOT 8
- Decoding message payloads HOT 2
- ConcurrentModificationException crash HOT 3
- java.util.ConcurrentModificationException HOT 4
- JSON serialization defaults modify property names HOT 2
- jcenter shutdown - February 2022 HOT 3
- Tries to reconnect with invalid token HOT 3
- Leaving channel causes timeout HOT 5
- `unmatched topic` after reconnect HOT 1
- Issue with AGP v8.0.0 R8 minification HOT 1
- Release 1.1.3 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javaphoenixclient.