ps
github.com/vhakulinen/push-server
go get github.com/vhakulinen/push-server
ps

github.com/vhakulinen/push-server

Server to receive and send notifies to clients

by Ville Hakulinen

v0.0.0-20151119110014-e29cf6a727ed (see all)License:GPL2
go get github.com/vhakulinen/push-server
Readme

push-server

Server to receive and send notifications to clients.

Use case

  • Irc message notifies (irssi)
  • Notify after long command has ran on remote machine
  • Basicly when ever you want notifies from remote machines to your desktop/laptop or say for your mobile (if someone creates app for it)

HTTP API

/register/

This will register new account and returns either new account's token or message to check email.

curl localhost:8080/register/ -d email=<email> -d password=<password>

Expects

paramrequiredtype
emailyesstring
passwordyesstring

Returns

statusreturn value
OK200
ERROR400

/retrieve/

This will return account's token. 400 if authentication fails.

curl localhost:8080/retrieve/ -d email=<email> -d password=<password>

Expects

paramrequiredtype
emailyesstring
passwordyesstring

Returns

statusreturn value
OK200
ERROR400

/pool/

This will return all pushdatas under specified token as JSON.

curl localhost:8080/pool/ -d token=<your_token_here>

Expects

paramrequiredtype
tokenyesstring

/push/

This pushes notify

curl localhost:8080/push/ -d token=<your_token_here> -d body=<message_body> \
-d title=<message_title>

Expects

paramrequiredtypedefualts
tokenyesstring
titleyesstring
bodynostringempty string
urlnostringempty string
prioritynointeger1
timestampnointeger0 - will be set to current time on clients

Returns

statusreturn value
OK200
ERROR400

Note

Priority values
valuemeaning
1Send to all clients
2Don't make sound on GCM client if TCP client is live
3Don't send to TCP client

/gcm/

This regsiters new Google Cloud Messaging client to specified token

curl localhost:8080/gcm/ -d token=<token> -d gcmid=<gcmid>

Expects

paramrequiredtypedefualts
tokenyesstring
gcmidyesstring

Returns

statusreturn value
OK200
ERROR400
Something wen't wrong on server500

/ungcm/

This unregsiters Google Cloud Messaging client

curl localhost:8080/ungcm/ -d gcmid=<gcmid>

Expects

paramrequiredtypedefualts
gcmidyesstring

Returns

statusreturn value
OK200
ERROR200

TCP clients

TCP clients is used to receive live notifies. To use this feature, connect to push-server with TCP/TLS connection (default port 9911) and send your token AND NOTHING ELSE. You'll now receive notifies where priority != 3. TCP client uses IRC-like ping pong messages.

PONG

When server sends ping message, it won't send any push data to that client until it responses with pong message. Ping message format is following: :PING <5char token>\n. Pong message: :PONG <5 char token from server>\n. Note the \n characther!

Server

Copy the push-serv.conf.def file to push-serv.conf or add the path with -config flag

Note

Everything except passwords are saved as plain text on the server.

GitHub Stars

12

LAST COMMIT

7yrs ago

MAINTAINERS

0

CONTRIBUTORS

2

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
v0.0.0-20151119110014-e29cf6a727ed
2yrs ago
No alternatives found
No tutorials found
Add a tutorial