WebSocket Client. How to send messages using function prompt()? #9372
-
I have found Deno's websocket chat example and I would like to know if it's possible to create a client that works in the command line. In the following example, Deno websocket client connects, sends a message, receives data and closes connection to the server.
In the following example, I attempt to create an interactive mode that connects and sends messages through the command prompt but for some reason, the while loop keeps messages from being sent. Can anyone help me figure out what I'm missing?
The original websocket server:
The original html/javascript websocket client code:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You're call to |
Beta Was this translation helpful? Give feedback.
You're call to
prompt
blocks the event loop from running. If you want a non blockingprompt
, usereadLines
fromstd/io
.