snp31server.py

fullphat edited this page Mar 25, 2018 · 12 revisions

Despite having the most catchiest name ever, snp31server.py is also amazingly impressive. Not only does it run a small SNP 3.1 server, if you run it on MacOS or certain supported variants of Linux, it will display actual on-screen notifications using the operating system's native tools as well.

Setting Up

snp31server.py can be cloned from GitHub. It requires Python 3 to run, so you need to make sure that's installed first. Once that's done, you should be good to go.

Launching

From a Terminal window, run:

python3.x snp31server.py [port]

Where x is the version of Python 3 you downloaded, and [port] is the port to listen for incoming connections on. If no port is specified, 9887 is used.

So, if you're using Python 3.6 and you want to listen on port 6060, you'd enter:

python3.6 snp31server.py 6060

Testing

You can use various different tools to test connectivity. If you have a Windows machine available, you could try SNP31send (included with Snarl 5.0), as follows:

snp31send -F 192.168.1.1 6060 -F -s "Sent from my Windows 7 PC" -t "Hello, world!" -i stock:misc-chair

Will, on macOS, generate something like this:

Hello, world!

You can also configure the Notification Pump demo (also included with Snarl 5.0) to forward notifications to the server.

Quote Of The Day

Note that neither of these examples need Snarl to be installed!

Limitations

Only forwarded and anonymous notifications are supported, all other commands will be ignored.

On macOS, the server relies on private Apple APIs to replace the application icon with its own - this functionality may be removed in subsequent releases of macOS.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.