https://github.com/james2doyle/post-socket
Turn a POST request (JSON) to Websocket event
https://github.com/james2doyle/post-socket
golang server webhook websocket
Last synced: over 1 year ago
JSON representation
Turn a POST request (JSON) to Websocket event
- Host: GitHub
- URL: https://github.com/james2doyle/post-socket
- Owner: james2doyle
- License: mit
- Created: 2018-09-09T01:35:58.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-09T01:51:56.000Z (almost 8 years ago)
- Last Synced: 2025-01-07T08:49:00.998Z (over 1 year ago)
- Topics: golang, server, webhook, websocket
- Language: Go
- Size: 11.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# POST Socket
> Turn a POST request (JSON) to Websocket event
### Config
```toml
# what port should the webhook web server run on?
WebhookPort = 8080
# what port should the websocket run on?
WebsocketPort = 8081
Logging = true
```
### Building with Docker
*Be sure to update the `EXPOSE` to follow the ports you setup in `config.toml`*
* `docker build -t post-socket .`
* `docker run post-socket:latest`
### Building with "go build"
* `go build`
* `./post-socket`
*With "go run":*
* `go run main.go`
### Deploying
You can use [now.sh](https://zeit.co/now) to deploy Docker apps. You can use their initial service for free. However, there is a limit on the number of deploys and also you are assigned random URL for each deploy. So this would not be a good option for long term usage.
Use `now` to deploy.
### Example
Open `example.html` on a webserver while the `post-socket` is running.
You can connect to the socket and send POST requests to the webhook server and see them come up on the socket connection.