WebSocket with webbit - yet another?
in
Library and Tool Development
•
2 years ago
hi,
i am tinkering with websockets a lot at the moment and put together a first proove of concept to implement
webbit into a library for more easy use in processing. a plain approach didn't seem to make sense in terms of stability.
so far i have a simple version, also inlcuding a webserver - provided by webbit/netty too - serving static files from a "html" directory inside the sketch.
i'd love to get feedback! if anyone is interested here is the library source:
https://github.com/muthesius/WebSocketP5
a direct download of the last version ready for use:
http://p5.twelvebytes.net/websocketP5-0.1.2/
an example is included. launch it and point your browser to
http://localhost:8080 . clicking inside the processing window should result in messages appearing onside the bowser. you can also easily send messages from the browser using javascript. OH; and you have to use chromium or a similar browser, that supports websockets, of course.
there's still much to do and actually this is my first library for processing, so please be kind ;)
one thing i cannot really get my head arround, is how to access a folder - not reading in a file - from the compiled jar? the idea is, too serve some static files, like scripts, etc from a common directory inside the library. to be honest, i didn't really get the documentation on paths within libraries. what i have so far is reading in the files as text and serving them from memory. any pointers on this very welcome.
thx! jens
2