I’ve installed anaconda and tornado and activated the environment on Ubuntu 18.0.4.
Here’s what I got (which appears to have reproduced the problem, but seems to have additional information that you didn’t have with Windows):
$ python3.7 wsserver.py
Websocket open
Websocket closed
Reason: None
Code : None
$ swipl wsclient.pl
Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.18)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.
For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).
?- client.
Sent "Message Hello"
Received websocket{data:end_of_file,opcode:close}
ERROR: Socket error: Broken pipe
ERROR: In:
ERROR: [19] websocket:ws_send(<stream>(0x5587204a6aa0,0x5587204a35f0))
ERROR: [18] <meta call>
ERROR: [17] setup_call_catcher_cleanup(websocket:ws_start_message(<stream>(0x5587204a6aa0,0x5587204a35f0),8,0),websocket:write_message_data(<stream>(0x5587204a6aa0,0x5587204a35f0),...),exit,websocket:ws_send(<stream>(0x5587204a6aa0,0x5587204a35f0))) <foreign>
ERROR: [14] websocket:ws_close_(<stream>(0x5587204a6aa0,0x5587204a35f0),1000,'God bye') at /usr/lib/swi-prolog/library/http/websocket.pl:547
ERROR: [13] setup_call_catcher_cleanup(websocket:true,websocket:ws_close_(<stream>(0x5587204a6aa0,0x5587204a35f0),1000,'God bye'),_30976,websocket:close(<stream>(0x5587204a6aa0,0x5587204a35f0))) at /usr/lib/swi-prolog/boot/init.pl:619
ERROR: [9] toplevel_call('<garbage_collected>') at /usr/lib/swi-prolog/boot/toplevel.pl:1113
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
^ Exception: (13) setup_call_catcher_cleanup(websocket:true, websocket:ws_close_(<stream>(0x5587204a6aa0,0x5587204a35f0), 1000, 'God bye'), _31218, websocket:close(<stream>(0x5587204a6aa0,0x5587204a35f0))) ?
I then turned on debug(websocket)
, debug(websocket(open))
, debug(websocket(close))
and ran with debug
to give a better traceback:
[debug] ?- client.
Sent "Message Hello"
% ws_receive(<stream>(0x558720594d20,0x558720594f30)): OpCode=end_of_file, RSV=_12038
% ws_receive(<stream>(0x558720594d20,0x558720594f30)) --> websocket{data:end_of_file,opcode:close}
Received websocket{data:end_of_file,opcode:close}
ERROR: Socket error: Broken pipe
ERROR: In:
ERROR: [19] websocket:ws_send(<stream>(0x558720594d20,0x558720594f30))
ERROR: [18] <meta call>
ERROR: [17] setup_call_catcher_cleanup(websocket:ws_start_message(<stream>(0x558720594d20,0x558720594f30),8,0),websocket:write_message_data(<stream>(0x558720594d20,0x558720594f30),...),exit,websocket:ws_send(<stream>(0x558720594d20,0x558720594f30))) <foreign>
ERROR: [16] setup_call_cleanup(websocket:ws_start_message(<stream>(0x558720594d20,0x558720594f30),8,0),websocket:write_message_data(<stream>(0x558720594d20,0x558720594f30),...),websocket:ws_send(<stream>(0x558720594d20,0x558720594f30))) at /usr/lib/swi-prolog/boot/init.pl:624
ERROR: [15] websocket:ws_send(<stream>(0x558720594d20,0x558720594f30),close(1000,'God bye')) at /usr/lib/swi-prolog/library/http/websocket.pl:352
ERROR: [14] websocket:ws_close_(<stream>(0x558720594d20,0x558720594f30),1000,'God bye') at /usr/lib/swi-prolog/library/http/websocket.pl:547
ERROR: [13] setup_call_catcher_cleanup(websocket:true,websocket:ws_close_(<stream>(0x558720594d20,0x558720594f30),1000,'God bye'),_13960,websocket:close(<stream>(0x558720594d20,0x558720594f30))) at /usr/lib/swi-prolog/boot/init.pl:619
ERROR: [12] setup_call_cleanup(websocket:true,websocket:ws_close_(<stream>(0x558720594d20,0x558720594f30),1000,'God bye'),websocket:close(<stream>(0x558720594d20,0x558720594f30))) at /usr/lib/swi-prolog/boot/init.pl:624
ERROR: [11] websocket:ws_close(<stream>(0x558720594d20,0x558720594f30),1000,'God bye') at /usr/lib/swi-prolog/library/http/websocket.pl:542
ERROR: [10] wsclient:client at /home/peter/Downloads/wsclient.pl:23
ERROR: [9] toplevel_call(user:user:client) at /usr/lib/swi-prolog/boot/toplevel.pl:1113
I haven’t run wireshark to figure out what’s happening at the TCP/IP level - not sure it’d show anything, as localhost TCP/IP gets short-circuited - but it appears that your server is just returning a close
.
Hope this helps.