-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add UI websocket open/close and send/receive #728
Conversation
Codecov Report
@@ Coverage Diff @@
## master #728 +/- ##
==========================================
- Coverage 85.13% 85.08% -0.05%
==========================================
Files 64 64
Lines 4124 4124
==========================================
- Hits 3511 3509 -2
- Misses 415 417 +2
Partials 198 198
Continue to review full report at Codecov.
|
b0b9331
to
4b7b291
Compare
ui/src/Message.elm
Outdated
@@ -146,13 +188,15 @@ view model = | |||
[ Input.text [ Input.id "message", Input.onInput SubmitMessage ] | |||
] | |||
, Button.button [ Button.secondary, Button.attrs [ Spacing.ml1 ], Button.onClick SendMessage ] [ text "Send" ] | |||
, Button.button [ Button.secondary, Button.attrs [ Spacing.ml1 ], Button.onClick WebsocketSend ] [ text "Websocket" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the tet is "Websocket"? It would be better that it is something like "Recieve" or "Listen" - user does not have to know really about underlaying technology.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, you need to transform this button in something like "Stop" or something, to stop listening (i.e. unsubscribe, i.e. close this websocket),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in the last commit.
ui/src/Websocket.js
Outdated
if (wss[url]) { | ||
wss[url].close(); | ||
} else { | ||
MF.log("Websocket is not open. URL: " + url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment OK? Looks like a copy of precious one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it just informs the user that the websocket he's trying to close is not open, so he can't close it. I can reword the text so that it becomes more clear.
f5d76be
to
7131dce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ui/src/Websocket.js
Outdated
app.ports.connectWebsocket.subscribe(function(data) { | ||
var url = MF.url(data); | ||
if (wss[url]) { | ||
MF.log("Websocket already open. URL: " + url ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use ''
instead of ""
here and in the rest of the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to use single quotes for the things that happen under the hood and to use the double quotes for the messages intended for the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
da778ac
to
966731d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Add websocket open/close and send/receive Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add websocket feedback/log to Elm Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Align WS open/close buttons Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add websocket query for channel list Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add websocket related encoders/decoders for port interops Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Fix .js indentation and simplify ws (dis)connect method Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Use single quotes consistently Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add HTTP Send and WS Listen Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
* Add websocket open/close and send/receive Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add websocket feedback/log to Elm Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Align WS open/close buttons Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add websocket query for channel list Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add websocket related encoders/decoders for port interops Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Fix .js indentation and simplify ws (dis)connect method Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Use single quotes consistently Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add HTTP Send and WS Listen Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
* Add websocket open/close and send/receive Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add websocket feedback/log to Elm Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Align WS open/close buttons Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add websocket query for channel list Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add websocket related encoders/decoders for port interops Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Fix .js indentation and simplify ws (dis)connect method Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Use single quotes consistently Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com> * Add HTTP Send and WS Listen Signed-off-by: Darko Draskovic <darko.draskovic@gmail.com>
Signed-off-by: Darko Draskovic darko.draskovic@gmail.com