Hello,
I need to access a secured websocket server (wss), is PureBasic able to do that?
Thanks
PureBasic and wss websocket?
Re: PureBasic and wss websocket?
not natively but there are user libs that support websockets
Windows 11, Manjaro, Raspberry Pi OS
Re: PureBasic and wss websocket?
Ok, so there's a couple ways to bypass this constraint. Thanks!
As a PureBasic newbie, I'll probably give a try to Stunnel before messing around with libs...
Also (just to make sure), OpenNetworkConnection() supports server names with path, right? (ex: http(or ws)://server.com/one/long/path/withf@ncycharacter)
As a PureBasic newbie, I'll probably give a try to Stunnel before messing around with libs...
Also (just to make sure), OpenNetworkConnection() supports server names with path, right? (ex: http(or ws)://server.com/one/long/path/withf@ncycharacter)
- NicTheQuick
- Addict
- Posts: 1226
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: PureBasic and wss websocket?
No, it does not. It simply connects to a host using a hostname or IP address. Paths only exist in the environment of a protocol like HTTP(S), (S)FTP, WebDAV and so on. But OpenNetworkConnection() is much more low level.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Re: PureBasic and wss websocket?
Oh ok, I see... I guess I have to use SendNetworkString() (string being: /one/long/path/withf@ncycharacter) once connected to host, to access the stream?
- NicTheQuick
- Addict
- Posts: 1226
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: PureBasic and wss websocket?
No, this is not how this works. It is much more complicated than this. But I am not able to teach it to you here. Let's see if an other user has a good idea to solve your issue.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Re: PureBasic and wss websocket?
Ah... Well, I'll try to find more about websocket syntax. Thanks anyway!
BTW, this is where I want to connect, if that helps: https://github.com/binance-exchange/bin ... streams.md Maybe it's obvious for coding gurus, but it's not for beginners...
edit: Hmm.. Well, Netzvamp's code (with Stunnel for wss) works great actually! (did you know websocket servers are case sensitive..? )
Thank you everybody for the help!
BTW, this is where I want to connect, if that helps: https://github.com/binance-exchange/bin ... streams.md Maybe it's obvious for coding gurus, but it's not for beginners...
edit: Hmm.. Well, Netzvamp's code (with Stunnel for wss) works great actually! (did you know websocket servers are case sensitive..? )
Thank you everybody for the help!
Re: PureBasic and wss websocket?
Hu ho... It seems something is wrong with memory, I get errors after a few seconds.
Code: https://gist.github.com/Netzvamp/8623def14501de15c9e4
(code is 3 years old...)
Win 7/x64, PureBasic 5.62 (x64)
I'm no expert but I can see some AllocateMemory() functions in loops (especially Repeat/ForEver) and no FreeMemory() function. The program is supposed to run 24/7, isn't it going to fulfill memory?
Code: https://gist.github.com/Netzvamp/8623def14501de15c9e4
(code is 3 years old...)
Any idea of what's wrong?(...)
[10:37:43] [ERROR] module_websocketclient.pb (Line: 337)
[10:37:43] [ERROR] Invalid memory access. (read error at address 18446744073709551615)
[10:37:58] The Program was killed.
[10:37:59] Waiting for executable to start...
[10:37:59] Executable type: Windows - x64 (64bit, Unicode)
[10:37:59] Executable started.
[10:38:29] [ERROR] module_websocketclient.pb (Line: 337)
[10:38:29] [ERROR] Invalid memory access. (read error at address 18446744073709551615)
[10:38:32] The Program was killed.
[10:38:35] Waiting for executable to start...
[10:38:35] Executable type: Windows - x64 (64bit, Unicode)
[10:38:35] Executable started.
[10:39:28] [ERROR] module_websocketclient.pb (Line: 273)
[10:39:28] [ERROR] Invalid memory access. (write error at address 73015296)
Win 7/x64, PureBasic 5.62 (x64)
I'm no expert but I can see some AllocateMemory() functions in loops (especially Repeat/ForEver) and no FreeMemory() function. The program is supposed to run 24/7, isn't it going to fulfill memory?
Re: PureBasic and wss websocket?
Anyone know what user libs these are that work with wss?idle wrote:not natively but there are user libs that support websockets
Thanks
WARNING: I dont know what I am doing! I just put stuff here and there and sometimes like magic it works. So please improve on my code and post your changes so I can learn more. TIA