Skip to content

Conversation

@seyyah
Copy link

@seyyah seyyah commented Feb 21, 2017

Usage:

In HTML/Javascript:

ws = new WebSocket('ws://IP_ADDRESS');
ws.binaryType = "arraybuffer";
var h = [0xfd, 0x01, 0x41, 0x81, 0xc1, 0xfe];
var m = [253, 1, 65, 129, 193, 254];
ws.send(new Uint8Array(h));

In serialport-server side,

$ serialport-server /dev/ttyUSB0
* websocket client (BINARY) <#{sid}> : "ý\u0001A\u0081Áþ"
* websocket client (BINARY) <#{sid}> : 253,1,65,129,193,254

Description:

$ irb
> h = [0xfd, 0x01, 0x41, 0x81, 0xc1, 0xfe]
> h.pack('U*')
\u0001A\u0081Áþ"

Usage:

In HTML/Javascript:

```javascript
ws = new WebSocket('ws://IP_ADDRESS');
ws.binaryType = "arraybuffer";
var h = [0xfd, 0x01, 0x41, 0x81, 0xc1, 0xfe];
var m = [253, 1, 65, 129, 193, 254];
ws.send(new Uint8Array(h));
```

In serialport-server side,

```sh
$ serialport-server /dev/ttyUSB0
* websocket client (BINARY) <#{sid}> : "ý\u0001A\u0081Áþ"
* websocket client (BINARY) <#{sid}> : 253,1,65,129,193,254
```

Description:

```ruby
$ irb
> h = [0xfd, 0x01, 0x41, 0x81, 0xc1, 0xfe]
> h.pack('U*')
"ý\u0001A\u0081Áþ"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant