Skip to content

Instantly share code, notes, and snippets.

View Alpe6825's full-sized avatar

Alex Alpe6825

View GitHub Profile
@nus
nus / main.cpp
Last active October 23, 2025 20:42
An example of emscripten with WebSocket.
// $ em++ -lwebsocket.js -o index.html main.cpp
#include <emscripten/emscripten.h>
#include <emscripten/websocket.h>
#include <stdio.h>
EM_BOOL onopen(int eventType, const EmscriptenWebSocketOpenEvent *websocketEvent, void *userData) {
puts("onopen");
EMSCRIPTEN_RESULT result;