dwyl / learn-go

🎢 Learn the Go programming language to build simple, maintainable and performant software.
GNU General Public License v2.0
7 stars 2 forks source link

`Go` `WebSocket` Example with Push to `Postgres` #4

Open nelsonic opened 2 weeks ago

nelsonic commented 2 weeks ago

We need write a lightweight (unauthenticated) WebSocket example in Go that pushes data to a Postgres Database. Essentially we are going to be replicating the hits which just receives requests and logs them to the DB.

The most similar project is: https://github.com/dwyl/hits-nodejs in terms of simplicity/structure except that the Node.js version is backed by fs not Postgres.

Todo

GO!

Context: We need this to pass basic events from the Web UI to the Backend. Eventually each WebSocket channel will be authenticated using a Token (TBD) that will be provided by our SSO... But that's complexity we don't need to deal with at this stage and is just focus on the basic.

Note: we may end up shifting this to it's own repo e.g: hits-go in the future ... But for now, just use this repo and expand the

@LuchoTurtle this is a task for whenever you feel you have "free" time or are "waiting" for someone to ask you to do something. Do it to the best of your abilities because we will be showing this to people who need to transition from Node.js to Go. As usual, please log your progress as comments in this issue and/or commits in the brach. Thanks.

LuchoTurtle commented 2 weeks ago

Gonna have a look at it 👌

nelsonic commented 2 weeks ago

Go recently broke into the Top 10 Programming Languages on GitHub: 🎉 https://github.blog/2023-11-08-the-state-of-open-source-and-ai/#the-most-popular-programming-languages

go-lang-in-top-10-languages-on-github

So we can update that section in the README.md. 📝

nelsonic commented 2 weeks ago

We could use a web framework for this example see: #5 🔍 Or we can try and make it as barebones as possible. 💭 What are your thoughts? 🤔