Location based Go PubSub server
Provides you a websocket server, that you may connect with your geo information (latitude, longitude, precision) and receive the messages from people connected to same channel.
- Open a websocket connection to
ws://localhost:8080/socket?lat=47.12&lng=120.43&precision=5&channel_id=xyz - This will connect you to a channel with the geohash token generated with provided latitude longitude information like
<channel_id>|<geohash> - You will start to listen to changes in this channel and subgeohashes(sublocations with higher precisions) and receive via websocket.
- You may send message to any location by basic http request with same location parameters
POST {message:hello, user:tuna} http://localhost:8080/messages?lat=47.12&lng=120.43&precision=5&channel_id=xyz - And the clients listening to those channels via websocket will receive your message
You may check here to have a clue about geohashes
- Redis
- Go
mkdir /your/pathexport GOPATH=/your/pathgo get github.com/garyburd/redigo/redisgo get github.com/gorilla/muxgo get github.com/gorilla/websocketgo get github.com/vargi/geopublishercd /your/path/src/github.com/vargi/geopublisher/go run main.go
- Used TomiHiltunen's geohash implementation for generating geohashes