Pregunta

(newb alert)

I'm using Java-WebSocket and json-simple.

After resolving problems with putting 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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top