SNP/HTTP Transport

Introduction

SNP/HTTP provides a way for applications to communicate with an instance of Snarl using HTTP.  This can be particularly beneficial for web-based applications which otherwise would have no means of communicating with the computer the browser is running on.

Limitations

  • SNP/HTTP does not currently support callbacks
  • Applications using SNP/HTTP must first register with Snarl before attempting to create notifications

Communication Overview

When enabled, the SNP/HTTP extension will create a listening socket on TCP port 80 (unless an alternative port number is set by the user).  When a request is received, it is converted into a Win32 IPC request by the extension and passed to Snarl.

Note: Applications using SNP must register with Snarl before attempting to create notifications.  The ability to create 'anonymous' notifications via earlier implementations of SNP has been deprecated and is not supported by SNP 2.0.  An application may re-register itself at any time; in which case it will receive the same token it previously registered with.  Once an application has registered successfully, it can add classes and create notifications.

Request Structure

An SNP/HTTP request is a standard Snarl request prefixed with the host (and, optionally, port number) to send it to, as follows:

http://<host>[:port]/<request>...

Port is only required if the receiving computer is listening on a port other than the default of 80.  Host may be 127.0.0.1 if the request is intended for an instance of Snarl running on the local computer

Example

Response Structure

The response format is as follows:

SNP/<version>/<status code>/<description>[/<data>]

ParameterDescription
Version The highest version of SNP the running instance of Snarl supports.  As of R2.4, this is "2.0"; as of R2.5, this is "3.0" 
Status Code The status code of the last request 
DescriptionA human-readable representation of the status code
Data Additional data - this is specific to the individual request 

Example

SNP/2.0/0/OK/636

Callbacks

Callbacks are not supported by SNP/HTTP.
Comments