Melkeydev / go-blueprint

Go-blueprint allows users to spin up a quick Go project using a popular framework
MIT License
2.07k stars 141 forks source link

Add websocket endpoint to advanced options #192

Closed MitchellBerend closed 2 months ago

MitchellBerend commented 2 months ago

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

Problem/Feature

Resolves #174

Description of Changes:

This PR adds an option to the --advanced flag that let's users add a websocket endpoint to their routes.go file automatically.

184 is still open so if that get's merged before this one, this pr will also include the flag option like that pr describes.

Checklist

MitchellBerend commented 2 months ago

Talked to @Ujstor about the generated websocket handler and they made the fair suggestion of changing the generated handler to be more in line with what websockets are typically used for; That is that they should be sending data without interaction of the client beyond the initial connection request.

The initial idea is for the server to send a timestamp to the client every 0.5 seconds.

MitchellBerend commented 2 months ago

During hand testing this feature the fiber option did not generate a full project [^1]. The linting jobs did pass but I think this qualifies as a 'flaky' test to me. Maybe these tests need to also include a build test of the generated project to make sure the application stays functional.

[^1]: the <- got sanitized into &lt;- since the template expects to output html