PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → [WD-21] - extremely simple connect-to-a-web-socket example
[WD-21] - extremely simple connect-to-a-web-socket example
Started by Andrew, Dec., 07 2017 3:37 PM - 10 replies
Posted on December, 07 2017 - 3:37 PM
Hi!

I'm attempting to create an extremely simple demo of a Windev web-socket client. Pretty much exactly what's found here >> http://demos.kaazing.com/echo/

I've created demos using the above web-socket in Javascript, Java, C#, and Python. However, I'm having some trouble getting Windev going on her. Has anyone here successfully connected to a third-party's web-socket with Windev before? I'd really appreciate some help ;)
Posted on December, 07 2017 - 4:34 PM
What's really interesting is I was able to research, figure it out, and make the other clients in about 5-10 minutes each. Javascript was under a minute.

But Windev? -- documentation seems to be coming up short. Online content seems to be coming up short. Forums seem to be coming up short (this is in regards to other threads -- there doesn't appear to be other folks attempting to connect to 3rd party web-sockets).
Posted on December, 07 2017 - 6:00 PM
... the difficulty of figuring this out with Windev is a bit demotivating. I might just be looking in the wrong places or something.

Now ... I have NOT checked the example projects. This is what I'll be doing now. The hard part is likely going to be finding an example that does not use a Web-Dev server.

Also - how active are the forums here? I thought there'd be more activity. Seems like there's a whole 2 or 3 folks providing all the answers. That'd be tough work. Really appreciate you guys! -- you're our only hope!
Posted on December, 07 2017 - 9:58 PM
My coworkers and I are working on a poem for Fabrice -- seems to be the man with the answers! If it turns out to be any good I'll post it. :thumbsup:

Don't suppose anyone's even read this yet, eh? Anyone out there? Anyone ever connected to a web-socket with a Windev application? -- a web-socket that was NOT on a Web-Dev server/application?
Posted on December, 07 2017 - 10:55 PM
Hi Andrew

I'm confused by "a Windev web-socket client. "

And this is why: a web socket is a mechanism allowing a web client (ie a
browser) to communicate via socket with a web server...


So you can have webdev code for the client, and or webdev code for the
server, but as WINDEV is NOT a web development tool, I do not understand
what it had to do with WEB-sockets...

So either you are confusing windev for webdev, or you are confusing
regular sockets with websockets, or I'm completely lost :-)

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 12/7/2017 à 9:37 AM, Andrew a écrit :
Hi!

I'm attempting to create an extremely simple demo of a Windev web-socket
client. Pretty much exactly what's found here >>
http://demos.kaazing.com/echo/

I've created demos using the above web-socket in Javascript, Java, C#,
and Python. However, I'm having some trouble getting Windev going on
her. Has anyone here successfully connected to a third-party's
web-socket with Windev before? I'd really appreciate some help ;)
Posted on December, 08 2017 - 12:58 PM
Sorry for the confusion, Fabrice.

I need Windev to connect to a web-socket. So far I've had 0% success with Windev, 100% success with everything else. It's a little frustrating is all. Can Windev connect TO a web socket? It's really just a socket in the end, but it seems there's something I'm missing with Windev -- something that may be different between a "normal" socket connection and a web-socket connection. Or maybe I'm just losing my mind.

If anyone's aware of how to establish a connection to a third party's web-socket, please help!

Another web-socket to try is wss://echo.websocket.org
Posted on December, 08 2017 - 2:24 PM
Hi Andrew,

I do not think that will be possible directly, as windev do NOT support
websockets, only sockets, and as websockets ARE differents than sockets
(https://stackoverflow.com/questions/4973622/difference-between-socket-and-websocket)


However, on the same page, you will see that it is possible to create a
work around, as websockets use http protocol (and that is usable in
windev using httprequest)

That may represent quite a bit of exploring, though...

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 12/8/2017 à 6:58 AM, Andrew a écrit :
Sorry for the confusion, Fabrice.

I need Windev to connect to a web-socket. So far I've had 0% success
with Windev, 100% success with everything else. It's a little
frustrating is all. Can Windev connect TO a web socket? It's really just
a socket in the end, but it seems there's something I'm missing with
Windev -- something that may be different between a "normal" socket
connection and a web-socket connection. Or maybe I'm just losing my mind.

If anyone's aware of how to establish a connection to a third party's
web-socket, please help!
Another web-socket to try is wss://echo.websocket.org
Posted on December, 12 2017 - 2:31 PM
You're right, I must be confused.

From my understanding, web-sockets are 100% sockets. The idea that web-sockets are not sockets is ... an odd one. From my usage of web-sockets, web-sockets are indeed sockets. From coding in c++, c#, java, etc. web-sockets are indeed sockets. What separates the web-socket is, yes, some framing and a wonderful HTTP handshake. But that's pretty much it.

A web-socket is a TCP socket connection & HTTP-like handshake for the connection. That's it. That's all. Nothing complicated about it.

I'm not asking for much; however, I do need the ability to implement the necessary "pieces" of the web-socket protocol/standard. Does Windev allow me to do this?
Posted on December, 12 2017 - 2:52 PM
Hi Andrew,

A web-socket is a TCP socket connection & HTTP-like handshake for the
connection. That's it. That's all. Nothing complicated about it.


Yep... and a socket is NOT using a http-like handshake... So if your
socket functions are NOT able to do the http handshake, then they are
not compatible with WEB socket... and that is our situation


I'm not asking for much; however, I do need the ability to implement the
necessary "pieces" of the web-socket protocol/standard. Does Windev
allow me to do this?


As I told you before, you can do http using httprequet... how you will
mix that with the socket system, I have no clue, and that will probably
mean going deep down in the understanding of the protocol in question.

So , easily? No...

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com
Registered member
10 messages
Posted on December, 01 2020 - 2:20 PM
Hello,

3 years later, is there any way to connect to websockets from Windev ?

Regards,

David
Registered member
54 messages
Popularité : +2 (2 votes)
Posted on December, 03 2020 - 11:12 AM
Hi Dav,
for websockets you can connect only in WebDev (browser) as explained in https://help.windev.com/en-US/…

If you have to connect Windev, you have to connect using the socket functions
https://help.windev.com/en-US/search2.awp…
but if you connect using a mix of windev and other, you have to pay attention on SocketChangeTransmissionMode function
https://help.windev.com/en-US/…
Windev sets as default SocketSizeAtBeginning, but if you connect to other technologies probably you have to adjust this value to SocketNoEndTag

Hope this help
Andrea