thank you bill that worked. sendb may not work... or has documentation issues.
modifying the demo (server handler onMessage send line) to: pD 'serv send'; r=. 0 ". wd 'ws sendb ',(":sk),' *', pD 3!:1 r_jrx_ where pD =: 1!:2&2 the output to the default client request is: �<< 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ┌─────────┬─┐ │serv send│3│ └─────────┴─┘ only 3 bytes are being sent. On the client side, only 1 byte appears to be in wsc0_jrx_ I assume there are 2 typos on the example for sendb at http://www.jsoftware.com/jwiki/Guides/JqtWebsocket should be: len=. 0 ". wd 'ws sendb ', socket, ' *Alphabet:', a. but adding the line: pD 0 ". wd 'ws sendb ', (":sk), ' *Alphabet:', a. results in 9 bytes sent There is a suggestion that sendb might not be necessary at all for J to J applications, "J itself does not distinguish between text and binary data, but binary data cannot always be represented as legal utf8 text and the remote side that connected to the socket may also care, use either send or sendb as appropriated." but only 9 bytes are sent when send instead of sendb is used too. ----- Original Message ----- From: bill lam <bbill....@gmail.com> To: programm...@jsoftware.com Cc: Sent: Friday, February 14, 2014 10:49:50 PM Subject: Re: [Jprogramming] Qt websockets and doevents Sorry, the error message was terse. in fact it expected either 1 ro 2 arguments for send. either "send socket" or "send socket data" try this wd 'ws send ', (": sk) , ' hello' or wd 'ws send ', (": sk) , ' "hello client, username:"' or wd 'ws send ', (": sk) , ' *hello client, username:' I guess the send in the demo should already use the * Пт, 14 фев 2014, Pascal Jasmin писал(а): > Another issue I've uncovered in single application client and server > communication, also applies to separate applications. > > It appears that the server receives the connect (onOpen) event first (before > client), but even though the server is connected, it is not safe for it to > send yet. > > For instance, modifying the demo file: \addons\ide\qt\demo.ijs > > in the elseif jws_onOpen section of wssvr_handler , adding the line: > smoutput 'serv connected' > > wd 'ws send ', (": sk) , ' hello client, username:' > > > (loading the file will also load a client web page app) > > Hitting connect on the web app will display following message in console: > > serv connected > |ws : Need socket [data]: 73313136 hello client, username:: wd > | (wd ::(''"_)'qer') (13!:8)3 > > The previous problem I was reporting was that the client sending "too fast" > caused no error on send, but a disconnect. Here the server has been told its > connected, and has a socket number, but this weird error. Some suggestions: > > Perhaps the connect event could be delayed until the 2 sides are "really > connected" ? > send should return _1 in above case? > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm -- regards, ==================================================== GPG key 1024D/4434BAB3 2008-08-24 gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm