It is currently Sat Dec 16, 2017 7:47 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: WebSocket Server
PostPosted: Thu Jun 16, 2016 3:11 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 19, 2010 3:42 am
Posts: 421
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!!!


Top
 Profile  
Reply with quote  
 Post subject: Re: WebSocket Server
PostPosted: Thu Jun 16, 2016 3:26 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 19, 2010 3:42 am
Posts: 421
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:
 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!


Top
 Profile  
Reply with quote  
 Post subject: Re: WebSocket Server
PostPosted: Wed Jun 29, 2016 10:24 am 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 19, 2010 3:42 am
Posts: 421
Hello,

just a little "problem".

In WebSocket_Server.pbi at this point:
Code:
debug peeks(*Object\Client()\RX_Frame()\Data, -1, #PB_Ascii)

in
Code:
Procedure Event_Callback(*Object.Object, *Callback.Event_Callback)

I get this result:
Code:
‰C²+§Test send²+§


After all threads done I am in my callback and do this:
Code:
*WSE\Text = PeekS(*Event_Frame\Payload, -1, #PB_Ascii)

I get this result:
Code:
Test send²+§


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...


Top
 Profile  
Reply with quote  
 Post subject: Re: WebSocket Server
PostPosted: Tue Jul 12, 2016 3:39 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Aug 15, 2009 6:59 pm
Posts: 1217
Dadido3 wrote:
Thorium wrote:
Will you add TSL?

It's planned, but i can't say when i'll add it.

Edit:
If TLS is needed you can use a webserver as proxy. For NGINX this may be helpful: http://stackoverflow.com/questions/12102110/nginx-to-reverse-proxy-websockets-and-enable-ssl-wss. But i haven't tried it.


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.


Top
 Profile  
Reply with quote  
 Post subject: Re: WebSocket Server
PostPosted: Fri May 19, 2017 7:11 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 03, 2011 4:52 am
Posts: 172
Location: Beirut, Lebanon
hello:
project doesn't compile with PB5.60: error: Base64Encoder(): Incorrect number of parameters.

any trick?
thanks

_________________
PureBasic: Surprisingly simple, diabolically powerful


Top
 Profile  
Reply with quote  
 Post subject: Re: WebSocket Server
PostPosted: Fri May 19, 2017 11:44 pm 
Offline
User
User
User avatar

Joined: Sat Jan 12, 2008 11:50 pm
Posts: 38
Location: Hessen, Germany
Hi morosh,

replace Base64Encoder with Base64EncoderBuffer. Or just redownload, as i have updated the include.

_________________
Website


Top
 Profile  
Reply with quote  
 Post subject: Re: WebSocket Server
PostPosted: Sat May 20, 2017 9:25 am 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 03, 2011 4:52 am
Posts: 172
Location: Beirut, Lebanon
Thank you

_________________
PureBasic: Surprisingly simple, diabolically powerful


Top
 Profile  
Reply with quote  
 Post subject: [SOLVED] WebSocket Server
PostPosted: Fri Aug 11, 2017 9:09 am 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 19, 2010 3:42 am
Posts: 421
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!


Top
 Profile  
Reply with quote  
 Post subject: Re: WebSocket Server
PostPosted: Tue Sep 19, 2017 2:46 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 19, 2010 3:42 am
Posts: 421
"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.


Top
 Profile  
Reply with quote  
 Post subject: Re: WebSocket Server
PostPosted: Fri Oct 27, 2017 2:31 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Apr 30, 2003 8:15 am
Posts: 942
Location: Germany
@Dadido3: thanks! Works fine with PB 5.45 :D

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..."


Top
 Profile  
Reply with quote  
 Post subject: Re: WebSocket Server
PostPosted: Thu Dec 07, 2017 11:27 am 
Offline
User
User

Joined: Mon Aug 31, 2009 2:11 pm
Posts: 34
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)

_________________
-----
Registered PureBasic Coder.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye