(newb alert)
I'm using Java-WebSocket and json-simple .
After resolving problems with put
ting to a JSONObject
with this question How to avoid Eclipse warnings when using legacy code without generics? , I'm now trying to sendToAll
obj
but am getting
error: method sendToAll in class WebSocketServerBase cannot be applied
to given types;
ws.sendToAll(obj);
^
required: String
found: JSONObject
reason: actual argument JSONObject cannot be converted to String by method
invocation conversion
1 error
How can I sendToAll
obj
?
obj
is a JSONObject
, and the method requires a String
. I'm sure there is some way to convert your obj
into a String
identifying it, but I don't know what it is.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.