nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests: remove some very-old useless tests
[nit.git]
/
examples
/
websocket_server.nit
diff --git
a/examples/websocket_server.nit
b/examples/websocket_server.nit
index
c011cf2
..
38029c3
100644
(file)
--- a/
examples/websocket_server.nit
+++ b/
examples/websocket_server.nit
@@
-23,22
+23,23
@@
var sock = new WebSocket(8088, 1)
var msg: String
var msg: String
-if not sock.listener.still_alive then
+if sock.listener.eof then
print sys.errno.strerror
end
sock.accept
print sys.errno.strerror
end
sock.accept
-while sock.listener.still_alive do
+while not sock.listener.eof do
if not sock.connected then sock.accept
if not sock.connected then sock.accept
- if stdin.poll_in then
+ if sys.stdin.poll_in then
msg = gets
msg = gets
- if msg == "exit" then sock.stop_server
+ printn "Received message : {msg}"
+ if msg == "exit" then sock.close
if msg == "disconnect" then sock.disconnect_client
sock.write(msg)
end
if sock.can_read(10) then
if msg == "disconnect" then sock.disconnect_client
sock.write(msg)
end
if sock.can_read(10) then
- msg = sock.read
+ msg = sock.read_line
if msg != "" then print msg
end
end
if msg != "" then print msg
end
end