# Error in Websockets Library

**URL:** <https://discourse.processing.org/t/error-in-websockets-library/12550>\
**Category:** Libraries\
**Created:** [July 7, 2019, 8:02am UTC](https://discourse.processing.org/t/error-in-websockets-library/12550 "2019-07-07T08:02:11Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [July 7, 2019, 8:47am UTC](https://discourse.processing.org/t/error-in-websockets-library/12550/2 "2019-07-07T08:47:05Z")

</div>

yes, did you start from

> **[GitHub - alexandrainst/processing\_websockets: A web socket library, including...](https://github.com/alexandrainst/processing_websockets)**
>
> A web socket library, including both server and client, for Processing - GitHub - alexandrainst/processing\_websockets: A web socket library, including both server and client, for Processing

see also

> [@Convert JSON String to JSON Object and Parse all data](https://discourse.processing.org/t/convert-json-string-to-json-object-and-parse-all-data/10407/4):
>
> actually i understood your question like you get a JSON like string over network already but recreating the JSON array structure makes you problems, and i answer you should repair the sending as {"value": "[[...], [...], [...], [..]]"} is not JSON conform OR i manage the read and restore anyway but the precondition is that that is the string you get? so please change void webSocketEvent(String msg) { println("\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*"); to void webSocketEvent…

* * *

test:

```auto
// https://github.com/alexandrainst/processing_websockets
// file websocket_server2.pde
// processing 3.5.3 on win7 / 64bit

import websockets.*;

WebsocketServer wss;
String outmsg="Server mouse click";

void setup() {
  size(500, 500);
  wss = new WebsocketServer(this, 8025, "/socket");
}

void draw() {
}

void mouseClicked() {  
  wss.sendMessage(outmsg);
}

void webSocketServerEvent(String msg) {
  println("event: "+msg);
}

```

```auto
// websockets
// https://github.com/alexandrainst/processing_websockets
// file websocket_client2.pde
// processing 3.5.3 on win7 / 64bit

import websockets.*;
String outmsg="Client mouse click";

String server = "ws://localhost:8025/socket"; 
// if i use my RPI as server: "ws://192.168.1.203:8025/socket"; // 
WebsocketClient wsc;

void setup() {
  size(500, 500);
  wsc= new WebsocketClient(this, server);
  println("pls wait for mouse click on server canvas");
}

void draw() {
}

void mouseClicked() {
  wsc.sendMessage(outmsg);
}

void webSocketEvent(String msg) {
  println("event: "+msg);
}

```

( means both sketch run on same computer )  
then the console print works / but might be little bit confusing regarding  
in what IDE window the print occurs.

---

_[View the full topic](https://discourse.processing.org/t/error-in-websockets-library/12550)._
