Hello,
First of all, I would like to apologize for the question. I am currently trying to port some code (to study if I could migrate existing projects to B4J and forget other tools I do already use). But, as usual, I am lost because the available examples are too complete.
Please, what could be the smallest websocket server code to send and receive strings between a B4J server and an existing HTML5 app ?
In another language I am used to, it is
Many thanks (and please, please, don't forward me to a tutorial (I think I did read them all, downloaded the code trying not to have to post this thread)
First of all, I would like to apologize for the question. I am currently trying to port some code (to study if I could migrate existing projects to B4J and forget other tools I do already use). But, as usual, I am lost because the available examples are too complete.
Please, what could be the smallest websocket server code to send and receive strings between a B4J server and an existing HTML5 app ?
In another language I am used to, it is
B4X:
on StartUP 'sub executed when the program starts
hide this stack 'this because the language used is based on stacks and has a GUI by default
accept connections on port 8000 with message "clientConnected" 'starts the socket server
end StartUP
on clientConnected pSocket
read from socket pSocket with message "messageReceived" 'will call the sub when a client is connected
end clientConnected
on messageReceived pSocket, pMsg 'psocket is the socket, pMsg is the message's string
write pMsg to socket pSocket 'sends the message back
read from socket pSocket with message "messageReceived" 'creates the loop to receive
end messageReceived
Many thanks (and please, please, don't forward me to a tutorial (I think I did read them all, downloaded the code trying not to have to post this thread)