stdio in a browser

Discussion to talk about software related topics only.
Post Reply
User avatar
dciliske
Posts: 623
Joined: Mon Feb 06, 2012 9:37 am
Location: San Diego, CA
Contact:

stdio in a browser

Post by dciliske »

Because I get bored and have the most exciting of Saturday nights... I put together a quick little feature using websockets.

This is a short example that takes stdio and remaps it to a websocket. The main webpage will autocreate a websocket to the module when the page is loaded. When said websocket is created, it will remap stdio to point to the websocket instead of serial. If the websocket is closed, it will revert stdio to whatever fd was standard IO at the time of the websocket's creation.

The really cool thing is that the module side code is incredibly, stupidly simple. One caveat, is that there's a minor issue in the current nndk with opening websockets, where they won't reset the fd conditions (writeAvail, ReadAvail, and HasError), so when you close and then reopen the websocket, after the first session per boot, it will error out, thinking that the socket is closing.

-Dan
Attachments
Console_APP.s19
(315.54 KiB) Downloaded 536 times
Console.tar.gz
(2.25 KiB) Downloaded 542 times
Dan Ciliske
Project Engineer
Netburner, Inc
Post Reply