Skip to content
Connect to a WebSocket server using AutoHotkey
AutoHotkey
Branch: master
Clone or download
G33kDude Eliminated race condition to do with assigning WebSocket event handlers
In JavaScript, a websocket's event handlers are assigned to it after creation/connection.
Normally, this is not a problem as JavaScript's single threaded nature requires code in the current
context to finish before it will start accepting the events.

In my implementation, I was calling out to the AHK function _SaveWS before assigning
the event handlers. This evidently caused some kind of context switch allowing JavaScript
to start accepting events before the handlers were all in place.

By accessing the websocket through the DOM rather than the previous method the need to
call out to _SaveWS is eliminated. By that, so is the race condition.
Latest commit 8a0c1f6 Jan 17, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Examples Eliminated race condition to do with assigning WebSocket event handlers Jan 16, 2018
LICENSE Initial commit Jun 26, 2017
README.md Adding files Jun 26, 2017
WebSocket.ahk Eliminated race condition to do with assigning WebSocket event handlers Jan 16, 2018

README.md

WebSocket.ahk

Connect to a WebSocket server using AutoHotkey

Connecting to a WebSocket Server

See the Examples folder for sample code that demonstrates usage

You can’t perform that action at this time.