|Do you know where your variables are?
RPC via mysql when running under websocketd?by schweini (Friar)
|on Sep 07, 2015 at 22:59 UTC
schweini has asked for the wisdom of the Perl Monks concerning the following question:
So I'm playing around with websockets, using websocketd.
I have two users connected, and each websocketd-spawend process has an open DBI connection, but they don't really know anything about each other, apart from the fact that there is a row in a table where both session ids are stored.
Is there a way to have one process write something to the database, and that the other process immediately detects this (maybe some kind of trigger?) so that the 2nd process may process this new data, and send data to the browser which is connected to it via the websocket?
I guess the normal way would be to do this via signals and other IPC mechanisms, but if at all possible, i'd like to minimize complexity.
EDIT: i guess the sane way to go is to use SysV shared memory via one of the many available modules. But I can't find any way of monitoring shared memory in a way that if process #1 modifies it, that process #2 somehow gets notified (be it via a signal, or something like Tie::Watch