-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
Hi,
I am using following code to connect to a server and send message. The server receives the messages and sends back the same message. However, the callback webSocketEvent is never called.
I do see that the server receives message from Processing client. Also, the server sends the message back because my other client (p5.js client) receives the same message. Note that server sends the message to all connected clients.
import websockets.*;
WebsocketClient wsc;
void setup() {
size(600, 400);
StringList headers = new StringList();
headers.append("User-Agent:Processing");
wsc = new WebsocketClient(this, "ws-server-url", headers);
}
void draw() {
}
void mousePressed() {
float x = mouseX/(float)width;
float y = mouseY/(float)height;
JSONObject json = new JSONObject();
json.setFloat("x", x);
json.setFloat("y", y);
wsc.sendMessage(json.toString());
// this.webSocketEvent(json.toString());
}
void webSocketEvent(String msg){
println(msg);
}
Could you please help me resolve this issue?
Metadata
Metadata
Assignees
Labels
No labels