• Stars
    star
    504
  • Rank 87,537 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Just a tiny, simple and real-time self-hosted pub/sub messaging service

Websocketify (wsify) v2.0 StackShare

Just a tiny, simple and realtime pub/sub messaging service

Quick Demo

Why

I wanted to create a tiny solution that can replace pusher and similar services and learning more about the realtime world, so I dispatched this project.

Features

  • No dependencies, just a single binary !
  • Light and Tiny.
  • Event-Driven Design webhooks.
  • A client can listen on any resource.
  • You control whether a client is allowed to connect, subscribe, unsubscribe using any programming language !.
  • A client defines itself using key via the url query param i.e ?key=123.
  • Send messages to only certain users.

Installation

  • Docker ? > docker run --network host alash3al/wsify -listen :8080 -webhook "http://localhost/wsify.php"
  • Binary ? > goto the releases page and download yours.
  • From Source ? > go get -u github.com/alash3al/wsify

Questions

(1)- How can a client/device connect to the websocket service?

by simply connecting to the following endpoint ws://your.wsify.service:port/subscribe

(2)- How can a client subscribe to a certain channel(s)/topic(s)?

after connecting to the main websocket service /subscribe, you can send a simple json payload commands to ask wsify to subscribe/unsubscribe you to/from any channel/topic you want!

(3)- What is the commands format?

{
	"action": "subscribe",
	"value": "testchan"
}

(4)- Can I control the client command so I can allow/disallow certain users?

Yes, each client can define itself using a query param ?key=client1, this key will be passed to the webhook endpoint 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"
}

(5)- How can I publish message to i.e testchan?

Just a post request to /publish with 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

(6)- Can I skip the webhook events for testing?

Yes, wsify --events="" empty events means "NO WEBHOOK, WSIFY!"

(7)- How can I secure the publish endpoint, so no one except me can publish ?!!

Easy :), Just change the endpoint to something more secure and hard to guess it is an alternative to access tokens .. etc, wsify --publish="/broadcasteiru6chefoh1Yee0MohJ2um5eepaephies3zonai0Cae7quaeb"

(8)- What about other options?

wsify --help will help you !

(9)- What is the websocket client used in demos?

Simple Websocket Client

(10)- How I can use it over SSl/TLS with Nginx?

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

Quick Demo2

Author

This project has been created by Mohamed Al Ashaal a Crazy Gopher ^^!

Contribution

  • Fork the Repo
  • Create a feature branch
  • Push your changes to the created branch
  • Create a pull request.

License

Wsify is open-sourced software licensed under the MIT License.

More Repositories

1

sqler

write APIs using direct SQL queries with no hassle, let's rethink about SQL
Go
2,031
star
2

redix

a very simple pure key => value storage system that speaks Redis protocol with Postgres as storage engine and more
Go
1,166
star
3

smtp2http

A tiny software that receive a smtp request (email) and send it to the specified webhook as a http post request
Go
410
star
4

lightify

a reverse proxy that boosts the web app performance!
Go
191
star
5

srchx

A standalone lightweight full-text search engine built on top of blevesearch and Go with multiple storage (scorch, boltdb, leveldb, badger)
Go
151
star
6

scraply

Scraply a simple dom scraper to fetch information from any html based website
Go
122
star
7

httpsify

a transparent HTTPS termination proxy using letsencrypt with auto certification renewal
Go
109
star
8

go-pubsub

An in-process simple publish/subscribe library for golang
Go
103
star
9

go-smtpsrv

a tiny package that implements SMTP server for Go projects
Go
95
star
10

re-txt

converts text-formats from one to another, it is very useful if you want to re-format a json file to yaml, toml to yaml, csv to yaml, ... etc
Go
64
star
11

dockssh

Dockssh, ssh into any container from anywhere with the help of redis for password storage
Go
61
star
12

bbadger

adding badger support to blevesearch
Go
59
star
13

xyr

Query any data source using SQL, works with the local filesystem, s3, and more. It should be a very tiny and lightweight alternative to AWS Athena, Presto ... etc.
Go
58
star
14

phoo

a very simple high performance PHP application server and php-fpm supervisor
Go
58
star
15

Plus

Asynchronous I/O environment in pure PHP
PHP
57
star
16

Horus

a minimal event-driven, flexible, portable and micro PHP web application framework
PHP
56
star
17

goukv

a key-value store with multiple backends including leveldb, badgerdb, postgresql
Go
52
star
18

scrapyr

a simple & tiny scrapy clustering solution, considered a drop-in replacement for scrapyd
Go
50
star
19

droxy

a transparent standalone http reverse proxy for docker containers
Go
45
star
20

sql2slack

send sql results periodically to slack
Go
34
star
21

xerver

a tiny static and fastcgi reverse proxy written in golang
Go
34
star
22

pxml-tpl

PHTML a smart tiny oo PHP HTML style template system, no more regex and no more large code, packags, ...
PHP
33
star
23

arp2http

notify the specified webhook when a device is connected/disconnected
Go
30
star
24

mailux

Experimental Passwordless Login even without sending emails/sms to users
Shell
29
star
25

goemitter

an event-emitter for golang
Go
22
star
26

katch

headless chrome as a service for generating PDF, PNG, JPEG and HTML of any web page
Go
16
star
27

aggrex

a crazy API gateway aggregation using javascript as a language and go as a runtime
Go
15
star
28

exeq

painless task queue manager for shell commands with an intuitive cli interface (execute shell commands in distributed cloud-native queue manager).
Go
13
star
29

axync

a smart cooperative multitasking kernel for php7
PHP
13
star
30

olive-go

Just a lightweight golang web application middleware
Go
13
star
31

img2pdf

convert a directory of images to a PDF file
Go
11
star
32

vidutils

a very simple, tiny and intuitive ffmpeg wrapper with a cli interface for inspecting & transforming media files supported by the original ffmpeg software
Go
11
star
33

go-schemaless

a schemaless implementation based on postgres and jsonb
Go
10
star
34

tix

a super simple stupid event-loop kernel in pure PHP
PHP
9
star
35

libsrchx

a simple wrapper for blevesearch created for srchx the tiny full-text search engine
Go
9
star
36

xerve

fast, tiny static file server with auto gzip & minify
Go
8
star
37

mylitedb

a mysql server backed by sqlite!
Go
8
star
38

funker

a platform for function as a service based javascript written in Go.
Go
7
star
39

go-univush

a universal push notification library written in go based on apns2 and firebase
Go
7
star
40

tlx

a dummy tls reverse proxy written in go
Go
6
star
41

dir2webp

convert images in directory/directories to webp format using the power of concurrent programming
Go
6
star
42

dart-path-selector

extract values from Map/List using dot-seprated strings you don't have to cast multiple times to fetch a simple values, this is very useful while working with i.e json data
Dart
5
star
43

uwatch

notify email(s) that a url is now online
Go
5
star
44

mysql2sqlite

a command-line utility to move data from mysql to sqlite
Go
5
star
45

xonsole

A tiny cli framework based on laravel\console, so you can use it without full laravel installation
PHP
4
star
46

go-fastcgi-client

A FastCGI client library for Golang projects
Go
4
star
47

HorusJS

A lightweight NodeJS microframework
JavaScript
3
star
48

cgify

a for fun script server (custom cgi)
Go
3
star
49

xtore

a document store based on cockroachdb
Go
3
star
50

wp-allowed-hosts

a plugin that protects your wp site from the CVE-2017-8295 vulnerability
PHP
2
star
51

alash3al

WHO AM I
2
star
52

xmg

a tiny microservice for getting perceptual hash of an image or faces in the image
Go
2
star
53

rsty

a tiny RESTful service middleware for Golang applications
Go
2
star
54

googly

a simple command line tool to search google with simple options
Go
2
star
55

goring

A simple consistent hashing ring implementation in Golang
Go
2
star
56

aof

A simple concurrency safe Append-Only-File for storage purposes
Go
2
star
57

olive.js

a lightweight micro javascript web application framework
JavaScript
1
star
58

php-myRouter

A PHP Router (/class/method/parm1/parm2/parm3/parm4/.....................)
PHP
1
star
59

z-pharo

Z-Pharo PHP CMS Framework
1
star
60

isup

check whether a url is up or down, and notify you whenever it become available
Go
1
star
61

LiteJS

A very tiny full featured template engine for javascript for both client and server sides, you need no-learning curve
JavaScript
1
star
62

odb

just a for-fun only-value database
Go
1
star