Howdy Monks! I am back again with another question. I am trying to establish a persistent connection to a gateway/websocket so i can add some functionality! I were trying to use REST::Client, but when the time come to do the connection/handshake with the actual gateway, i got something like "protocol not supported", which I took as REST::Client didnt support wss. I can connect to the api server all day long and read messages with REST::Client, but i cannot seems to post responses from my bot.
So this is where I started floundering around and copy/pasting code while not understanding it. Besides copy/pasting code, I believe IO::Socket would be a better approach to this, but I dont fully understand the whole server/client thing great either.
I would post some code but it would be the first failed attempt with the "protocol not supported" error.
To post code, I will post some psuedo code because I am not very sure as to what I need to do to actually make the request and read the responses with IO::Socket.
Do I need a server, or a client, or do I need a server and client? any help is very much appreciated :)
use strict; use warnings; use IO::Socket; use JSON; my $wss = 'ws://gateway'; my $client = IO::Socket->new($wss, 5000, tcp); #most examples use loca +lhost instead # do I do the handshake query here before the loop and then go to +the loop and start filtering # responses? while(1){ #filter responses }
I appreciate any hints of wisdom.
In reply to Persistent connection to a websocket/gateway (wss://) by james28909
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |