I am searching for a way to enable client-side socket communications (open 
socket, send data to socket, read data from socket, close socket) in a 
language program compiled with emscripten emcc and run as a webassembly 
program in a browser. I'd like to see if Emscripten WebSockets API is a 
suitable vehicle, as I'd prefer to stick solely with C language and avoid 
using Javascript as an itermediary between my (wasm) client and the 
browser/server environment.

https://emscripten.org/docs/porting/networking.html

I have not been able to find any getting-started guide or information on 
Emscripten WebSockets API -- ideally I'd like to find a "hello world" level 
program (written in C) that shows usage of this API.

Thanks very much for any advice/pointers.

Dave

###

https://emscripten.org/docs/porting/networking.html

Emscripten WebSockets API

WebSockets API provides connection-oriented message-framed bidirectional 
asynchronous networking communication to the browser. It is the closest to 
TCP on the web that web sites can access, direct access to TCP sockets is 
not possible from web browsers.


Emscripten provides a passthrough API for accessing the WebSockets API from 
C/C++ code. This is useful for developers who would prefer not to write any 
JavaScript code, or deal with the C/C++ and JavaScript language interop. 
See the system include file <emscripten/websocket.h> for details. One 
benefit that the Emscripten WebSockets API provides over manual WebSockets 
access in JavaScript is the ability to share access to a WebSocket handle 
across multiple threads, something that can be time consuming to develop 
from scratch.


To target Emscripten WebSockets API, you must link it in with a 
“-lwebsocket.js” linker directive.


-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/9c92c060-d4eb-49a8-8ae4-42a2da43b8c3o%40googlegroups.com.

Reply via email to