Skip to content
Snippets Groups Projects
Verified Commit 54082d0f authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: check read/write call

parent 936a5332
No related branches found
No related tags found
No related merge requests found
...@@ -236,7 +236,7 @@ class WebSocketDatasource extends Datasource { ...@@ -236,7 +236,7 @@ class WebSocketDatasource extends Datasource {
const self = this; const self = this;
let response; let response;
if (self[connectionSymbol].socket||self[connectionSymbol].socket.readyState!==1) { if (self[connectionSymbol]?.socket?.readyState!==1) {
return Promise.reject('The connection is not established.'); return Promise.reject('The connection is not established.');
} }
...@@ -292,7 +292,7 @@ class WebSocketDatasource extends Datasource { ...@@ -292,7 +292,7 @@ class WebSocketDatasource extends Datasource {
write() { write() {
const self = this; const self = this;
if (self[connectionSymbol].socket||self[connectionSymbol].socket.readyState!==1) { if (self[connectionSymbol]?.socket?.readyState!==1) {
return Promise.reject('The connection is not established.'); return Promise.reject('The connection is not established.');
} }
......
...@@ -98,7 +98,8 @@ describe('Websocket', function () { ...@@ -98,7 +98,8 @@ describe('Websocket', function () {
}).catch((err) => { }).catch((err) => {
done(new Error(err)); done(new Error(err));
}) })
}, 1000) },
500)
}).timeout(10000); }).timeout(10000);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment