Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Monster
Manage
Activity
Members
Plan
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSS
Libraries
Javascript
Monster
Commits
936a5332
Verified
Commit
936a5332
authored
2 years ago
by
Volker Schukai
Browse files
Options
Downloads
Patches
Plain Diff
fix: check socket state
parent
dc8addf1
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
application/source/data/datasource/websocket.mjs
+8
-3
8 additions, 3 deletions
application/source/data/datasource/websocket.mjs
with
8 additions
and
3 deletions
application/source/data/datasource/websocket.mjs
+
8
−
3
View file @
936a5332
...
...
@@ -231,14 +231,15 @@ class WebSocketDatasource extends Datasource {
/**
* @return {Promise}
* @throws {Error} the options does not contain a valid json definition
* @throws {Error} the data cannot be read
* @throws {TypeError} value is not an object
*/
read
()
{
const
self
=
this
;
let
response
;
if
(
self
[
connectionSymbol
].
socket
||
self
[
connectionSymbol
].
socket
.
readyState
!==
1
)
{
return
Promise
.
reject
(
'
The connection is not established.
'
);
}
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
self
[
receiveQueueSymbol
].
isEmpty
())
{
resolve
();
...
...
@@ -291,6 +292,10 @@ class WebSocketDatasource extends Datasource {
write
()
{
const
self
=
this
;
if
(
self
[
connectionSymbol
].
socket
||
self
[
connectionSymbol
].
socket
.
readyState
!==
1
)
{
return
Promise
.
reject
(
'
The connection is not established.
'
);
}
let
obj
=
self
.
get
();
let
transformation
=
self
.
getOption
(
'
write.mapping.transformer
'
);
if
(
transformation
!==
undefined
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment