a real-time pub/sub messaging service with an event driven design using web-hooks.
5.1K
Just a tiny, simple and realtime pub/sub messaging service

I wanted to create a tiny solution that can replace
pusherand similar services and learning more about the realtime world, so I dispatched this project.
webhooks.connect, subscribe, unsubscribe using any programming language !.key via the url query param i.e ?key=123.docker run --network host alash3al/wsify -listen :8080 -webhook "http://localhost/wsify.php"go get -u github.com/alash3al/wsifyby simply connecting to the following endpoint
ws://your.wsify.service:port/subscribe
after connecting to the main websocket service
/subscribe, you can send a simple json payloadcommandsto ask wsify tosubscribe/unsubscribeyou to/from any channel/topic you want!
{
"action": "subscribe",
"value": "testchan"
}
Yes, each client can define itself using a query param
?key=client1, this key will be passed to thewebhookendpoint as well as the event being executed, and here is the event format:
{
// one of the following: connect|subscribe|unsubscribe|disconnect
"action": "subscribe",
// the channel if provided
"value": "testchan",
// the key provided by the client
"key": "client1"
}
testchan?Just a post request to
/publishwith the following format:
{
// the channel you want to publish to
"channel": "testchan",
// the data to be send (any format)
"payload": "testchan",
// array of clients "keys" (if you want certain clients only to receive the message)
"to": []
}
i.e
curl -X POST \
-H "Content-Type: application/json" \
-d '{"payload": "hi from the terminal", "channel": "testchan"}' \
http://localhost:4040/publish
Yes,
wsify --events=""empty events means "NO WEBHOOK, WSIFY!"
Easy :), Just change the endpoint to something more secure and hard to guess it is an alternative to access tokens .. etc,
wsify --publish="/broadcasteiru6chefoh1Yee0MohJ2um5eepaephies3zonai0Cae7quaeb"
wsify --helpwill help you !
You can use proxy, add this lines on your Nginx configration
location /websocket/subscribe {
proxy_pass http://localhost:4040/subscribe;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
Now you can call websocket by wss://yourdomain.com/websocket/subscribe

This project has been created by Mohamed Al Ashaal a Crazy Gopher ^^!
Wsify is open-sourced software licensed under the MIT License.
Content type
Image
Digest
Size
135.2 MB
Last updated
almost 8 years ago
docker pull alash3al/wsify