WBus : simple all purpose web bus
WBus stands for Web Bus and it is a simple all purpose method to get two or more clients (browsers) communicating using a web page as the communication channel.
Version: 0.1
Download
Lot of web applications use databases (i.e MySQL ) to enqueue messages shared between clients and these usually offer lot of useful features (as locking) that could be used for this purpose.
Comet, a pretty new model for web apps, allows a web server to push data to a browser, without the browser explicitly requesting it … simply wonderful!
I usually use one of the above solutions, but sometime I need something simplier, for all purposes, that doesn’t rely on databases and doesn’t request the use of a comet server.
WBus uses two files, one for sharing messages and another one for exclusive locking.
Performances? Good enought for lot of nice jobs. Why? Kernels (such as Linux or FreeBSD) don’t flush to disk every single file modification but have a mechanism called “buffer cache” that
handles writing process to enhance performances, so write and read calls are performed on a copy of the file stored in RAM that periodically will be written on hard disk.
Example1: A nice 2D web chat
Example2: Very simple ajax web chat
WBus CALLS
- write
wbus.php?action=write&data=MSG
- read
wbus.php?action=read
Read call return a json encoded array of wbus-structures.
wbus-structure = { ts: TIMESTAMP, // float microseconds sid: CLIENT_SESSION_ID, data: MSG }
Thanks to:
Motocarota for images



