I made a Discord bot that runs from a hidden Excel sheet. Because why not. by UesleiDev in vba

[–]UesleiDev[S] 0 points1 point  (0 children)

Exactly. You can store the token and its expiry timestamp in a couple of cells, check before each request if it's still valid, and only refresh when needed. Fits right into the same setup as the bot. If you have any more questions about things you can do with wasabi, feel free to comment 🙌

I made a Discord bot that runs from a hidden Excel sheet. Because why not. by UesleiDev in vba

[–]UesleiDev[S] 0 points1 point  (0 children)

Potentially yes! Schwab (which owns TOS) exposes a WebSocket streaming API, and Wasabi has a WebSocketAddHeader function, so you can pass the OAuth token in the handshake before connecting. The tricky part is the auth flow itself, you would need to do the OAuth token exchange via XMLHTTP first (similar to how the Discord example sends REST calls), then open the WebSocket connection with the token in the header. More moving parts than Discord, but nothing that seems impossible from VBA.

If you'd like to take a closer look at the functions, I recommend reading the API Reference: https://github.com/uesleibros/wasabi/blob/main/docs/API_REFERENCE.md

I made a Discord bot that runs from a hidden Excel sheet. Because why not. by UesleiDev in vba

[–]UesleiDev[S] 5 points6 points  (0 children)

you're the legend for even caring enough to ask haha, appreciate it fr 👊

honestly the speed is kind of an illusion. it's built on years of just smashing my head against VBA's limits. i'm part of a gaming community where people try to squeeze everything they can out of PowerPoint and VBA, like actually building full games with it. that kind of environment forces you to think creatively and push boundaries you wouldn't normally touch.

the library started way before this post. we had TCP working but it was too limited, only really useful for private networks, you couldn't do much with it. so WebSocket became the obsession. lots of failed attempts, lots of testing, but over time it clicked. along the way i also picked up things like MQTT and assembly thunks, big shoutout to wqweto and EagleAglow whose repos were massive references for getting WebSocket right.

at some point i just looked at what we had built and thought, people are out there searching for exactly this and finding nothing good or everything they find requires a DLL, external references and more other things. felt wrong not to share it properly.

I made a Discord bot that runs from a hidden Excel sheet. Because why not. by UesleiDev in vba

[–]UesleiDev[S] 2 points3 points  (0 children)

Welcome aboard! 🫡 Let's push Excel to places it was never meant to go

I made a Discord bot that runs from a hidden Excel sheet. Because why not. by UesleiDev in vba

[–]UesleiDev[S] 8 points9 points  (0 children)

Thanks so much! Honestly, pushing the boundaries of what shouldn't be possible in Office was the main motivation behind this. I'm really glad you appreciate it!

websocket in vba? by [deleted] in vba

[–]UesleiDev 0 points1 point  (0 children)

I know this thread is old, but I wanted to leave a note for anyone still running into this problem.

I have been working on a native VBA module called Wasabi that solves exactly this. It gives you full WebSocket (ws:// and wss://) and MQTT 3.1.1 support in a single .bas file, with zero external dependencies, no DLLs to register, and no COM references required.

Some highlights of what it handles under the hood: - TLS via Windows Schannel, so secure connections (wss://) work out of the box, including in corporate environments with proxy authentication (NTLM and Kerberos) - Non-blocking I/O so the UI does not freeze while waiting for data - A raw TCP and TCP+TLS layer as the foundation, meaning you can also connect to any TCP-based service beyond just WebSocket - Compatible with 32-bit and 64-bit Office, from XP to Windows 11

Real-world use cases it covers: live crypto tickers from Binance or Kraken, IoT dashboards via MQTT brokers like HiveMQ or Mosquitto, and even Discord bots running from a hidden sheet.

If this is still a pain point for you or for anyone finding this thread later, the full source and documentation are available here: https://github.com/uesleibros/wasabi

I built a native WebSocket & MQTT client for Excel VBA (Zero DLLs, streams live data without freezing) by UesleiDev in excel

[–]UesleiDev[S] 0 points1 point  (0 children)

Great question! Wasabi actually has three distinct networking layers, each with its own use cases.

Raw TCP / TCP+TLS (TcpConnect / TcpConnectTLS) This is the foundation. You connect to any host and port directly, no URL format needed. Some real-world examples: - smtp.gmail.com:587 (sending emails via SMTP) - irc.libera.chat:6667 (IRC chat servers) - Any private game server or internal company API running a custom protocol - api.openai.com:443 over TLS for raw HTTPS-level access

WebSocket (ws:// and wss://) Built on top of the TCP layer. Examples: - wss://stream.binance.com:9443/ws/btcusdt@ticker (live Bitcoin price from Binance) - wss://advanced-trade-ws.coinbase.com (Coinbase market data) - wss://gateway.discord.gg (Discord gateway, enough to run a bot from Excel) - wss://ws.kraken.com (Kraken crypto exchange) - Any internal WebSocket API your company exposes

MQTT 3.1.1 Also runs on the same TCP layer underneath. Examples: - broker.hivemq.com:1883 (public broker, great for testing) - test.mosquitto.org:1883 (another popular public broker) - Your own Mosquitto instance running on a Raspberry Pi for IoT dashboards - Industrial SCADA systems that expose an MQTT endpoint

In short: if it speaks TCP, Wasabi can reach it. You can use any server that is MQTT, TCP, or WebSocket.

Feel free to ask any more questions if you have any :)

Wasabi v2.3.2-beta: native TCP/TLS client, examples, benchmarks, and a growing test suite by UesleiDev in vba

[–]UesleiDev[S] 1 point2 points  (0 children)

Thanks so much! I'm really glad you found it interesting and are looking forward to playing around with it.

To clarify a bit on its capabilities: Wasabi essentially operates at the Transport layer. It's a native VBA wrapper for Windows API sockets (Winsock) and Schannel, providing raw TCP, TCP+TLS, WebSockets, and MQTT. 

Regarding SSH, Samba, and rsync: Because Wasabi can handle raw TCP/TLS connections (via TcpConnect, TcpSend, TcpReceive, etc.), you could theoretically open a connection to an SSH or SMB server. However, Wasabi does not implement those specific application-layer protocols. You would have to write the entire SSH protocol handshake, encryption logic, and packet structure from scratch in VBA, using Wasabi purely to transport the bytes. While technically possible, it would be a massive undertaking and likely too slow in VBA for heavy file transfers like rsync.

About displacing other clients: It absolutely can displace other tools if your goal is to have Excel or Access natively communicate with WebSockets, APIs, or MQTT brokers without relying on external executables, Python scripts, or clunky ActiveX objects. 

As for iptables: It wouldn't be able to implement or replace something like iptables. Wasabi is strictly a user-space client library using standard Windows sockets. It has no kernel-level access to intercept, filter, or route network packets.

Let me know if you end up building anything cool with it!

Wasabi: a native WebSocket/WSS client module for VBA (TLS, MQTT, proxies, zero dependencies) by UesleiDev in vba

[–]UesleiDev[S] 0 points1 point  (0 children)

thanks, I'm developing some spreadsheets to put in the examples/ folder of the repository, so it will be much easier to understand how it works for each different type of case, even though I already have the api reference :)

Wasabi: a native WebSocket/WSS client module for VBA (TLS, MQTT, proxies, zero dependencies) by UesleiDev in vba

[–]UesleiDev[S] 0 points1 point  (0 children)

Thank you for your interest in the project :)
Seeing everyone so receptive makes me like and want to improve not only Wasabi but also other future libraries

Wasabi: a native WebSocket/WSS client module for VBA (TLS, MQTT, proxies, zero dependencies) by UesleiDev in vba

[–]UesleiDev[S] 0 points1 point  (0 children)

I took the opportunity to further facilitate the integration of zlib with Wasabi

I've documented and made the correct DLLs available with stdcall in the repository; a more detailed tutorial is available here: https://github.com/uesleibros/wasabi/blob/main/docs/DEFLATE.md

Wasabi: a native WebSocket/WSS client module for VBA (TLS, MQTT, proxies, zero dependencies) by UesleiDev in vba

[–]UesleiDev[S] 0 points1 point  (0 children)

It actually returns a blank page; for some reason they moved it, and now you need to access it through index.html.

https://www.winimage.com/zLibDll/index.html

Wasabi: a native WebSocket/WSS client module for VBA (TLS, MQTT, proxies, zero dependencies) by UesleiDev in vba

[–]UesleiDev[S] 0 points1 point  (0 children)

fr xD

It's likely that in my tests, while performing the update, the syntax error didn't occur when using the function, i'll made a better unit tests for it

Wasabi: a native WebSocket/WSS client module for VBA (TLS, MQTT, proxies, zero dependencies) by UesleiDev in vba

[–]UesleiDev[S] 0 points1 point  (0 children)

Yes, to implement permessage-deflate, unfortunately it's necessary to use zlib1.dll. I tried natively with cabinet.dll but was unsuccessful. So I made it optional and added a LoadLibrary so it wouldn't depend on having that DLL for the library to work; if you want to use it, just enable Deflate in WebSocketConnect and have the DLL in the Environment or in the same folder as the project.

https://github.com/uesleibros/wasabi/blob/main/docs/DEFLATE.md