Skip to content

A simple example of proxying Server-Sent Events via Caddy proxy to a GopherJS front end.

License

Notifications You must be signed in to change notification settings

jraedisch/go_sse_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This is a simple example of proxying Server-Sent Events via Caddy proxy to a GopherJS front end.

Setup

  • $ go get -u github.com/jraedisch/go_sse_example
  • $ cd $GOPATH/src/github.com/jraedisch/go_sse_example
  • $ openssl req -x509 -nodes -days 365000 -newkey rsa:2048 -keyout selfsigned.key -out selfsigned.crt
  • add streaming.example.com to /etc/hosts
  • http://www.robpeck.com/2010/10/google-chrome-mac-os-x-and-self-signed-ssl-certificates
  • $ go get -u ./...
  • $ go get -u github.com/mholt/caddy/caddy
  • $ go get -u github.com/gopherjs/gopherjs
  • $ gopherjs build -mwv client/client.go -o static/client.min.js
  • $ go run server.go
  • $ sudo caddy
  • open https://streaming.example.com
  • done

Misc

  • There is no hot reloading, but GopherJS will watch for file changes. Changes to webapp.go require a restart.
  • Do not vendor GopherJS, since it will result in hard to decipher bugs. See gopherjs/gopherjs#415.
  • For live deployment you need to provide a separate Caddyfile, that could be much simpler. See https://caddyserver.com/docs/getting-started.
  • Production ready projects should probably add some specs :)

About

A simple example of proxying Server-Sent Events via Caddy proxy to a GopherJS front end.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published