simple-server-sent-event

module
v0.0.0-...-84424ca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2023 License: Apache-2.0

README

WIP

Go Reference Go Report Card Coverage Status Contribute with Gitpod

simple-server-sent-event

Open a SSE connection and get a response message with its formatted time when hit an endpoint

Install

Prerequisite

Note

Required:

git clone git@github.com:rrobrms/simple-server-sent-event.git
cd simple-server-sent-event
go mod tidy         # to download modules

Usage

Start the server

go run cmd/main.go

Init the sse connection with an "keep-alive" header

  • GET the endpoint http://localhost:1323/listener

Then when you hit the desired endpoint, we can compute the message

  • GET on the endpoint http://localhost:1323/event

Cleanned logs

⇨ http server started on [::]:1323
Client connected
data: 08-04-2023 23:59:25 CEST - Hello, world!

Client connected
data: 08-04-2023 23:59:36 CEST - Hello, world!

Client connected
data: 08-04-2023 23:59:57 CEST - Hello, world!

Client connected
data: 09-04-2023 00:00:12 CEST - Hello, world!

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL