Skip to content

Instantly share code, notes, and snippets.

View SeidChr's full-sized avatar

Christian Seidlitz SeidChr

View GitHub Profile
@SeidChr
SeidChr / ws.ps1
Created March 19, 2021 14:57 — forked from byt3bl33d3r/ws.ps1
Async Websocket PowerShell client (producer/consumer pattern)
<#
References:
- https://docs.microsoft.com/en-us/dotnet/api/system.net.websockets.clientwebsocket?view=netframework-4.5
- https://github.com/poshbotio/PoshBot/blob/master/PoshBot/Implementations/Slack/SlackConnection.ps1
- https://www.leeholmes.com/blog/2018/09/05/producer-consumer-parallelism-in-powershell/
#>
$client_id = [System.GUID]::NewGuid()
$recv_queue = New-Object 'System.Collections.Concurrent.ConcurrentQueue[String]'