Throughout humankind, from caveman, to philosophers, to scientists, the question of: How could one have enough computer resources to run two 4K videos streams and the latest AAA video-game on max settings while also having a web irc client running on the side? That's preposterous!
Not anymore! Introducing: a simple WebAssembly IRC client, finally you can manage your resources without dropping any frames!
This is an in-progress web socket IRC client written in C and compiled to WebAssembly, it's supposed to be single channel. Objectives as of now are configuring desired channel and nickname and having functionalities as far as receiving and sending messages.
I really like streaming websites, I really dislike depending on other's services to stream. While programming my own forum with streaming capabilities using CPPCMS I encountered an issue, I couldn't find a simple web client, most of them use bouncers and gateways and honestly it seemed a bit overwhelming to use for something as simple as a one channel, send and receive message client on my website.
I turned this issue on a opportunity to learn WebAssembly using Emscripten.
An IRC web client not unlike one seen on twitch, youtube and dlive.
For this project I was using inspIRCd with the following config file.
#-#-#-#-#-#-#-#-#-#-#-#- WEB SOCK CONF -#-#-#-#-#-#-#-#-#-#-#-
<module name="sha1">
<module name="websocket">
<websocket defaultmode="text">
<wsorigin allow="*">
<bind address="127.0.0.1" port="7002" hook="websocket">
As of now the server is static, before compiling change the IP address to connect to on main.c's main main function
EmscriptenWebSocketCreateAttributes ws_attrs = {"ws://127.0.0.1:7002", NULL, EM_TRUE};
Compile with make
Run test.html on your browser and open console, as soon as you join a channel you can use the send button and text input to send messages to the IRC chat
If by any chance you get a CORS error then you'll have to explicitly enable CORS sharing, you can do that easly with this python script, now all you have to do is change on your test.html
<script src="./bin/wasm_irc.js">/*IMPORT*/</script>
to access your python server such as:
<script src="http:localhost:8000/bin/wasm_irc.js">/*IMPORT*/</script>
- Use arguments to connect to the server on webassembly, using argc and argv is simples but I'm not yet sure on how to set arguments on JS's Module call yet.
Comment code.Build a better Makefile, right now it's a glorified static shell call.Refactor parsersuch as no more need for.parse_login
maybe set.fill
's content to parse_irctake out.emscripten_run_script
out of parser, as it's supposed to only parse message into structp_info
, let all messages handling be made byonmessage
or create another handler that responds if needed
Make a better user interface on html+js end(Good enough).- Create simple test runs to facilitate future development
- Userlist
- Add direct messaging support, e.g:
/pm @foo bar
and message "bar" only showing on foo's chat.