niv/websocket.nim

example doesn't work

Closed this issue · 5 comments

nim c -o:app_server examples/serverexample.nim
nim c -o:app_client examples/clientexample.nim
# in terminal tab 1:
./app_server
# in terminal tab 2:
./app_client

shows for terminal tab 2:

connected!
ping
(opcode: Cont, data: 5af1f03d7063d34100000001)
ping
(opcode: Cont, data: 5af1f0437063d34100000002)

but nothing is shown for tab 1
(I'd expect to see: "New websocket customer arrived!")

EDIT didn't realize examples/clientexample.nim was just connecting to https://websocket.org/echo.html ; but how about examples/serverexample.nim ? would be nice to have an example showing how to talk to the server created with examples/serverexample.nim

EDIT
works with:

  let ws = waitFor newAsyncWebsocketClient("localhost",
    Port 8080, "/?encoding=text", ssl = false, protocols = @["myfancyprotocol"])

would still make sense to include this in examples/clientexample.nim (say, controlled by a mode/flag to avoid code duplication)

Seems fine now

Why with exe files? :)

@hlaaftana indeed websocket.nim/examples/clientexample.exe (+ 1 other) was inadvertently added

dom96 commented

Please add .exe to the .gitignore :)

or better yet, generate binaries in a build folder that's gitignore'd