Easy Websocket Boilerplate in Go
- This version was adapted from eranyanay
- Publish messages on server and receive a result of your use case and business rules back with a simple full-duplex message at TCP connections
- Send messages with a default
AUTH_HEADER
environment and receive again a result for this publish
- Publish a message to all TCP active connections. This example is common when you need to send to all clients a state or a new notify message about a new content and you need update your app with this
- Publish a message to a specific user with TCP active connections. This example is common when you need to send to a user about changes in your contents, process, states or rules.
- This code was developed to handle many requests and simultaneous connections
- Install Postgresql and create your database with the same DB_DATABASE_NAME value in your .env file
- Run:
go run src/infra/migration/setup.go
- Run:
go run server.go
- Run:
go run src/examples/execute-use-case/client.go YourUserId
- Estabilish a Single Connection:
go run src/examples/connect/client.go YourUserId
- Run:
go run src/examples/write-to-all-clients/client.go YourUserId
- Estabilish a Single Connection:
go run src/examples/connect/client.go YourUserId
- Run:
go run src/examples/write-to-an-user/client.go YourUserId
- For further security rules, add auth header as JWT and valid iss and exp with low timestamp tls