niv / websocket.nim

websockets for nim
http://niv.github.io/websocket.nim/docs/0.1.1/websocket.html
Other
101 stars 25 forks source link

example doesn't work #39

Closed timotheecour closed 6 years ago

timotheecour commented 6 years ago
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)

metagn commented 6 years ago

Seems fine now

data-man commented 6 years ago

Why with exe files? :)

timotheecour commented 6 years ago

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

dom96 commented 6 years ago

Please add .exe to the .gitignore :)

timotheecour commented 6 years ago

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