Page 2 of 3
Re: WebSocket Server
Posted: Thu Jun 16, 2016 3:11 pm
by HanPBF
If I only asked earlier...
Now it works seemless!
I got strange client side disconnects in the browser; and information there is somewhat... less.
Thanks a lot for the new code and Your help!!!
Re: WebSocket Server
Posted: Thu Jun 16, 2016 3:26 pm
by HanPBF
How do I get the data sent from the client?
The public structure Event_Frame is used then?
Maybe too easy...
I am at that point; of course not only text but data...
Code: Select all
Event_Frame\Payload = *Object\Client()\RX_Frame()\Data + *Object\Client()\RX_Frame()\Payload_Pos
Event_Frame\Payload_Size = *Object\Client()\RX_Frame()\Payload_Size
*Callback(*Object, *Object\Client(), #Event_Frame, Event_Frame)
FreeMemory(*Object\Client()\RX_Frame()\Data)
Oh man, it's PeekS(..., -1, #PB_Ascii)...
The browser dares to send ascii that...
O.k. works now; thanks!
Re: WebSocket Server
Posted: Wed Jun 29, 2016 10:24 am
by HanPBF
Hello,
just a little "problem".
In WebSocket_Server.pbi at this point:
Code: Select all
debug peeks(*Object\Client()\RX_Frame()\Data, -1, #PB_Ascii)
in
Code: Select all
Procedure Event_Callback(*Object.Object, *Callback.Event_Callback)
I get this result:
After all threads done I am in my callback and do this:
Code: Select all
*WSE\Text = PeekS(*Event_Frame\Payload, -1, #PB_Ascii)
I get this result:
Do the 3 characters at the end still belong to the protocol and can I strip them off simply?
Damn... got the problem writing this...
Payload size has to be used in peeks...
Will keep it in the forum...
Re: WebSocket Server
Posted: Tue Jul 12, 2016 3:39 pm
by Thorium
Since TLS is very important for my webservice i am using libwebsockets now. Finaly got it to compile. Compiling OpenSSL was a pain. Currently i am translating the example server from c to PB.
Re: WebSocket Server
Posted: Fri May 19, 2017 7:11 pm
by morosh
hello:
project doesn't compile with PB5.60: error: Base64Encoder(): Incorrect number of parameters.
any trick?
thanks
Re: WebSocket Server
Posted: Fri May 19, 2017 11:44 pm
by Dadido3
Hi morosh,
replace Base64Encoder with Base64EncoderBuffer. Or just redownload, as i have updated the include.
Re: WebSocket Server
Posted: Sat May 20, 2017 9:25 am
by morosh
Thank you
[SOLVED] WebSocket Server
Posted: Fri Aug 11, 2017 9:09 am
by HanPBF
WebSocket does not work; using AJAX instead...
I use the example given with the WebSocket_Server code.
In Internet Explorer 11 I got this problem:
"SCRIPT12008: WebSocket Error Status Code 403, Not Found"
(When I put nonsense URL I get correct error "... Code 200 ...".)
In the PureBasic code the events are triggered!
Any idea?
I know that's no problem with PureBasic / WebSocket Server.
Put I could not find any solution.
Btw., Firefox works!
Any help really apreciated!
Re: WebSocket Server
Posted: Tue Sep 19, 2017 2:46 pm
by HanPBF
"WebSocket does not work; using AJAX instead..."
To make things clear; the websocket server source post works of course!
My local config of internet explorer 11 is crazy and can not be changed.
Seems like it does not work with local web socket server while Firefox, Vivaldi works and IE11 works with echo websocket site.
Re: WebSocket Server
Posted: Fri Oct 27, 2017 2:31 pm
by dige
@Dadido3: thanks! Works fine with PB 5.45
If someone is interested in webapps, I built a chat client for the server with SpiderBasic for testing purposes:
http://forums.spiderbasic.com/viewtopic.php?f=12&t=1362
Re: WebSocket Server
Posted: Thu Dec 07, 2017 11:27 am
by stmdbe2019
1. My site is only
HTTPS://www.example.com/chat.html
2. PB is running as ws://
How do you enable `WSS://` on the existing PB server?
(without hacking nginx, stunnel, proxy server's, not depending on third party tools absolutely natively with PB)
Re: WebSocket Server
Posted: Thu Feb 22, 2018 3:01 pm
by Thorium
shamun wrote:1. My site is only
HTTPS://www.example.com/chat.html
2. PB is running as ws://
How do you enable `WSS://` on the existing PB server?
(without hacking nginx, stunnel, proxy server's, not depending on third party tools absolutely natively with PB)
You can't enable it. WSS uses TLS which the server posted here is not supporting and doing it without any third party tools/libs is a pretty big project.
I ended up using libwebsocket but you need to work your way through compiling openssl first, it was a pain. Compiling of libwebsocket was easy.
Re: WebSocket Server
Posted: Tue Feb 27, 2018 11:27 pm
by stevie1401
The server hangs up after a short time.
How can I do it without thread?
Re: WebSocket Server
Posted: Wed Feb 28, 2018 8:15 pm
by Dadido3
I have tried to reproduce that bug, but i wasn't able to do so on Windows or Linux, even with over 100 clients. But while looking over the code i found a possible deadlock case which i fixed. (Double locking of a mutex from the same context)
There were also some other small things which i fixed and optimized, so it shouldn't hurt to update.
I also added a description and an example on how to use polling instead of the threaded callback. In case of polling, the include still uses threading internally, but the event callback will be called from whatever context you wish.
Re: WebSocket Server
Posted: Thu Mar 01, 2018 9:45 pm
by bbanelli
Dadido3 wrote:I have tried to reproduce that bug, but i wasn't able to do so on Windows or Linux, even with over 100 clients.
Hi Dadido3,
could you please clarify what is the particular constraint for number of concurrent users? Protocol itself, programming or hardware limitation?