Skip to content

an HTTP/1.1 server to send postgres LISTEN payloads via Server-Sent Events

Notifications You must be signed in to change notification settings

docteurklein/pg-sse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pg-sse

what ?

An http server sending postgres LISTEN payloads via Server-Sent-Events.

how ?

setup postgres

docker-compose up -d
export PGHOST=0 PGPORT=5432 PGUSER=api
psql -f schema.sql

run the server

export PG_DSN=postgres://postgres@localhost
export BIND_ADDR=0.0.0.0:3001

cargo run

listen to events

curl -i 0:3001/users -H 'Last-Event-ID: 4cd99657-3d81-4527-941f-8872317741ae'

publish events

curl -i 0:3000/events -H 'content-type: application/json' -i -d '@-' <<-EOF
	[
		{"name": "user-registered", "topic": "users", "version": 2, "payload": {"name": "john"}},
		{"name": "user-changed-password", "topic": "users", "version": 2, "payload": {"name": "john"}}
	]
EOF

About

an HTTP/1.1 server to send postgres LISTEN payloads via Server-Sent Events

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published