WebSocket Server
Re: WebSocket Server
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!!!
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
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...
Oh man, it's PeekS(..., -1, #PB_Ascii)...
The browser dares to send ascii that...
O.k. works now; thanks!
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
Hello,
just a little "problem".
In WebSocket_Server.pbi at this point:
in
I get this result:
After all threads done I am in my callback and do this:
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...
just a little "problem".
In WebSocket_Server.pbi at this point:
Code: Select all
debug peeks(*Object\Client()\RX_Frame()\Data, -1, #PB_Ascii)
Code: Select all
Procedure Event_Callback(*Object.Object, *Callback.Event_Callback)
Code: Select all
‰C²+§Test send²+§
Code: Select all
*WSE\Text = PeekS(*Event_Frame\Payload, -1, #PB_Ascii)
Code: Select all
Test send²+§
Damn... got the problem writing this...
Payload size has to be used in peeks...
Will keep it in the forum...
Re: WebSocket Server
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.Dadido3 wrote:It's planned, but i can't say when i'll add it.Thorium wrote:Will you add TSL?
Edit:
If TLS is needed you can use a webserver as proxy. For NGINX this may be helpful: http://stackoverflow.com/questions/1210 ... le-ssl-wss. But i haven't tried it.
Re: WebSocket Server
hello:
project doesn't compile with PB5.60: error: Base64Encoder(): Incorrect number of parameters.
any trick?
thanks
project doesn't compile with PB5.60: error: Base64Encoder(): Incorrect number of parameters.
any trick?
thanks
PureBasic: Surprisingly simple, diabolically powerful
Re: WebSocket Server
Hi morosh,
replace Base64Encoder with Base64EncoderBuffer. Or just redownload, as i have updated the include.
replace Base64Encoder with Base64EncoderBuffer. Or just redownload, as i have updated the include.
[SOLVED] WebSocket Server
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!
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
"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.
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
@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
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
"Daddy, I'll run faster, then it is not so far..."
-
- User
- Posts: 89
- Joined: Mon Aug 31, 2009 2:11 pm
Re: WebSocket Server
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)
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)
-----
Registered PureBasic Coder.
Registered PureBasic Coder.
Re: WebSocket Server
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.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)
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.
-
- User
- Posts: 42
- Joined: Sat Oct 18, 2014 7:14 am
Re: WebSocket Server
The server hangs up after a short time.
How can I do it without thread?
How can I do it without thread?
Re: WebSocket Server
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.
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
Hi Dadido3,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.
could you please clarify what is the particular constraint for number of concurrent users? Protocol itself, programming or hardware limitation?