Compare commits

...

4 Commits

Author SHA1 Message Date
semantic-release-bot 69ad85c715 chore(release): 0.1.0-develop.17 [skip ci]
# [0.1.0-develop.17](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.16...v0.1.0-develop.17) (2023-09-01)

### Bug Fixes

* browser returns a Blob, so convert to a buffer if we have a blob ([80dd92d](80dd92ddb1))
* missing uri argument for node WS ([8b7ffa8](8b7ffa8821))
2023-09-01 10:40:31 +00:00
Derrick Hammer e4bcd774ab
Merge remote-tracking branch 'origin/develop' into develop 2023-09-01 06:39:35 -04:00
Derrick Hammer 80dd92ddb1
fix: browser returns a Blob, so convert to a buffer if we have a blob 2023-09-01 06:39:25 -04:00
Derrick Hammer 8b7ffa8821
fix: missing uri argument for node WS 2023-09-01 06:38:51 -04:00
4 changed files with 19 additions and 5 deletions

View File

@ -1,3 +1,11 @@
# [0.1.0-develop.17](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.16...v0.1.0-develop.17) (2023-09-01)
### Bug Fixes
* browser returns a Blob, so convert to a buffer if we have a blob ([80dd92d](https://git.lumeweb.com/LumeWeb/libs5/commit/80dd92ddb13da043f6f41d34941c81eaf2608e33))
* missing uri argument for node WS ([8b7ffa8](https://git.lumeweb.com/LumeWeb/libs5/commit/8b7ffa8821779c769ed2f5772854537675ab5da6))
# [0.1.0-develop.16](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.15...v0.1.0-develop.16) (2023-09-01)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/libs5",
"version": "0.1.0-develop.16",
"version": "0.1.0-develop.17",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/libs5",
"version": "0.1.0-develop.16",
"version": "0.1.0-develop.17",
"dependencies": {
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/libs5",
"version": "0.1.0-develop.16",
"version": "0.1.0-develop.17",
"type": "module",
"main": "lib/index.js",
"repository": {

View File

@ -24,7 +24,13 @@ export class WebSocketPeer extends BasePeer implements Peer {
this._socket.addEventListener(
"message",
async (event: MessageEvent<any>) => {
await callback(event.data);
let data = event.data;
if (data instanceof Blob) {
data = Buffer.from(await data.arrayBuffer());
}
await callback(data);
},
);
@ -39,7 +45,7 @@ export class WebSocketPeer extends BasePeer implements Peer {
public static async connect(uri: URL): Promise<WebSocket> {
return new Promise((resolve, reject) => {
const socket = isNode ? new WS.WebSocket() : new WebSocket(uri);
const socket = isNode ? new WS.WebSocket(uri) : new WebSocket(uri);
socket.addEventListener("open", () => {
resolve(socket);
});