-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from dom96/style-fixes
Style fixes and other improvements
- Loading branch information
Showing
2 changed files
with
77 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import ../src/jswebsockets | ||
|
||
var ws = openws("ws://echo.websocket.org/") | ||
var socket = newWebSocket("ws://echo.websocket.org/") | ||
var outputid = "output" # nicer syntax for appending | ||
|
||
ws.onopen = proc(e:Event) = | ||
socket.onOpen = proc (event: Event) = | ||
outputid.append("sent: test") | ||
ws.send("test") | ||
ws.onmessage = proc(e:MessageEvent) = | ||
outputid.append("received: ",e.data) | ||
ws.close(scNormal,"received msg") | ||
ws.onclose = proc(e:CloseEvent) = | ||
outputid.append("closing: ",e.reason) | ||
socket.send("test") | ||
socket.onMessage = proc (event: MessageEvent) = | ||
outputid.append("received: ", event.data) | ||
socket.close(scNormal,"received msg") | ||
socket.onClose = proc (event: CloseEvent) = | ||
outputid.append("closing: ", event.reason) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters