mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2017
Posts: 3
F
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Dec 2017
Posts: 3
Good afternoon (or morning... or night?)

Just a quick problem I am having. I'm playing around with SReject's mWebsocket (AWESOME!) trying to get it to connect to [url=wss://irc-ws.chat.twitch.tv][url=wss://irc-ws.chat.twitch.tv][url=wss://irc-ws.chat.twitch.tv]wss://irc-ws.chat.twitch.tv[/url][/url][/url] in order to start learning and playing with websockets. Probably not a great way to come back to mIRC after several year hiatus, but I love to be challenged. In hindsight, I should probably stick to the easier scripting bot stuff of twitch using just mTwitchcore and JSONforMIRC (also by SReject... THANKS DUDE!) but what's the fun in that? Anyway, long story short: can't get it to connect. I get it to handshake and upgrade but when it gets to sending the frameData and frameSEND it ends up closing after a few moments. I searched far and wide - literally - trying to see how I could get it to connect. Not a whole lot of stuff out there on using mIRC with websockets. I even looked at other examples in python and java just to see if I'm just missing something obvious.

Here is my code: https://pastebin.com/QhNWQHq9

Here is my output in WebSocketDebug: https://pastebin.com/x8m63q7h

Just for kicks to see if it's just me screwing it up I went to:

https://www.unrealircd.org/files/dev/ws/websocket_unrealircd.html

and typed in the irc-websock-server for twitch and ended up getting to : RCVD: :tmi.twitch.tv NOTICE * :Improperly formatted auth - as the error message so, it's definitely me.

But yeah any help would be appreciated! Also, it's my first time here and posting so happy scripting everyone!

Joined: Dec 2017
Posts: 3
F
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Dec 2017
Posts: 3
Holy cannoli! I probably should have mentioned you would need the jsonformirc.mrc and also mWebsocket(the preferred build that you want) in order to try this out. You can just google "Websockets mIRC" and "JSON mIRC" and it will pop up.

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Once the handshake is complete you need to send two frames: (1) a TEXT frame containing your chat oauth token and (2) another containing your username/nick. There may be a third frame required -- as I haven't messed with the irc-over-websocket interface. Anyways:

Code:
on *:SIGNAL:WebSocket_READY_TwitchWeb:{
  ;; [...]

  WebSockWrite -t+t $WebSock PASS oauth:YourOAuthTokenHere $+ $crlf
  WebSockWrite -t+t $WebSock NICK YourTwitchNameHere $+ $crlf
  
  ;; This one may not be needed, leave it commented out unless twitch continues to complain
  ;; WebSockWrite -t+t USER YourTwitchNameHere 0 * :... $+ $crlf
}


Other things to consider: Make sure you are replying to twitch-sent pings(not to be confused with websocket protocol pings; my mWebSocket script handles those automatically).


Side Note: mWebSocket does not need/depend on JSON for mIRC

Last edited by FroggieDaFrog; 21/12/17 11:44 PM.

I am SReject
My Stuff
Joined: Dec 2017
Posts: 3
F
Self-satisified door
OP Offline
Self-satisified door
F
Joined: Dec 2017
Posts: 3
ARGH! I knew it was something obvious...

And! I like how the man himself was the one to reply, and very quickly.

Thanks! I'll keep playing with it.

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Its no problem. I have so many 'tool' scripts floating around its not uncommon for me to stumble upon someone needing help with one :P

FYI: I'm on twitch.tv's #mirchelp if you need to pick my brain about one of my scripts

Last edited by FroggieDaFrog; 22/12/17 12:19 AM.

I am SReject
My Stuff

Link Copied to Clipboard