Skip to content

Commit

Permalink
Merge pull request #1 from openziti-test-kitchen/add-server-side-events
Browse files Browse the repository at this point in the history
Add server side events
  • Loading branch information
dovholuknf committed Oct 13, 2023
2 parents 67a744b + 4e12a2e commit ae10975
Show file tree
Hide file tree
Showing 26 changed files with 878 additions and 84 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.idea
build
build
*.jwt
*.json
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ FROM debian:bookworm-slim

RUN apt update && apt install ca-certificates -y

COPY build/appetizer .
COPY *.html .
COPY build/appetizer /
COPY http_content /http_content

ENTRYPOINT [ "./appetizer" ]
WORKDIR /
ENTRYPOINT [ "/appetizer" ]
3 changes: 3 additions & 0 deletions clients/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ func (dc *ZitiDialContext) Dial(_ context.Context, _ string, addr string) (net.C

func NewZitiClient(idFile string) *http.Client {
ctx := ContextFromFile(idFile)
return NewZitiClientFromContext(ctx)
}
func NewZitiClientFromContext(ctx ziti.Context) *http.Client {
zitiDialContext := ZitiDialContext{context: ctx}

zitiTransport := http.DefaultTransport.(*http.Transport).Clone() // copy default transport
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions clients/reflect/reflect.go → clients/reflect.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func main() {
conWrite := bufio.NewWriter(svc)

for {
fmt.Print("Enter some text to send: ")
text, err := reader.ReadString('\n') //read a line from input
if err != nil {
fmt.Println(err)
Expand Down
14 changes: 9 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ module openziti-test-kitchen/appetizer
go 1.20

require (
github.com/TwiN/go-away v1.6.11
github.com/caddyserver/certmagic v0.19.2
github.com/microcosm-cc/bluemonday v1.0.26
github.com/openziti/edge-api v0.25.33
github.com/openziti/sdk-golang v0.20.99
github.com/sirupsen/logrus v1.9.3
Expand All @@ -12,6 +14,7 @@ require (
require (
github.com/Jeffail/gabs v1.4.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa // indirect
Expand All @@ -30,6 +33,7 @@ require (
github.com/go-openapi/validate v0.22.1 // indirect
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand Down Expand Up @@ -76,13 +80,13 @@ require (
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20221031165847-c99f073a8326 // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.10.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
28 changes: 18 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ github.com/Jeffail/gabs v1.4.0 h1://5fYRRTq1edjfIrQGvdkcd22pkYUrHZ5YC/H2GJVAo=
github.com/Jeffail/gabs v1.4.0/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/TwiN/go-away v1.6.11 h1:ICUp2WE4YmO8wfKix/dqmrbmr61fD0f9I3IOCmqay7U=
github.com/TwiN/go-away v1.6.11/go.mod h1:h1BfHu5UwQ1PasB8u+8uDXactyVbQcN/lOyeQ9Ow/H8=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
Expand Down Expand Up @@ -253,6 +257,8 @@ github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
Expand Down Expand Up @@ -346,6 +352,8 @@ github.com/mholt/acmez v1.2.0 h1:1hhLxSgY5FvH5HCnGUuwbKY2VQVo8IU7rxXKSnZ7F30=
github.com/mholt/acmez v1.2.0/go.mod h1:VT9YwH1xgNX1kmYY89gY8xPJC84BFAisjo8Egigt4kE=
github.com/michaelquigley/pfxlog v0.6.10 h1:IbC/H3MmSDcPlQHF1UZPQU13Dkrs0+ycWRyQd2ihnjw=
github.com/michaelquigley/pfxlog v0.6.10/go.mod h1:gEiNTfKEX6cJHSwRpOuqBpc8oYrlhMiDK/xMk/gV7D0=
github.com/microcosm-cc/bluemonday v1.0.26 h1:xbqSvqzQMeEHCqMi64VAs4d8uy6Mequs3rQ0k/Khz58=
github.com/microcosm-cc/bluemonday v1.0.26/go.mod h1:JyzOCs9gkyQyjs+6h10UEVSe02CGwkhd72Xdqh78TWs=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/dns v1.1.55 h1:GoQ4hpsj0nFLYe+bWiCToyrBEJXkQfOOIvFGFy0lEgo=
github.com/miekg/dns v1.1.55/go.mod h1:uInx36IzPl7FYnDcMeVWxj9byh7DutNykX4G9Sj60FY=
Expand Down Expand Up @@ -548,8 +556,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -633,8 +641,8 @@ golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -729,13 +737,13 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -748,8 +756,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

<head>
<meta charset="UTF-8">
<script async src="https://www.googletagmanager.com/gtag/js?id=G-2WJQ4K5W3C"></script>
<script src="analytics.js"></script>
<title>Awesomesauce!</title>
<link rel="stylesheet" href="./reflectMessages.css">
<script src="chat.js"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700;800&display=swap');

Expand Down Expand Up @@ -258,6 +262,12 @@
}
}

@media (min-width: 1400px) {
.container {
width: 1350px;
}
}

.container-fluid {
padding-right: 15px;
padding-left: 15px;
Expand Down Expand Up @@ -1229,6 +1239,7 @@
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 10px;
text-align: left;
}

pre code {
Expand Down Expand Up @@ -1268,10 +1279,6 @@
</head>

<body>
<!-- partial:index.partial.html -->
<!--Hey! This is the original version
of Simple CSS Waves-->

<div class="header">

<!--Content before waves-->
Expand Down Expand Up @@ -1309,22 +1316,25 @@ <h3>First, clone this 👉<a href="https://github.com/openziti-test-kitchen/appe
</h3>
</div>
<div class="col-md-8 col-md-offset-2 col-sm-12">
<h3 class="mb8">Next up, save your token to where you cloned the repo</h3>
<h3 class="mb8">Next up, save your token to the cloned the repo</h3>
<button class="btn btn-primary btn-block mb16" name="action" type="button"
onclick="window.location.href ='/download-token?token={{ .Token }}'">
onclick="window.location.href ='/download-token?token={{ .Token }}'" style="margin: 10px;">
Download Token
</button>
<p>This token will allow you to securely enroll your device. Once enrolled, it grants your process access to the demo
services hosted by this server, protected using OpenZiti's application-embedded zero trust design</p>
</div>
<div class="col-md-8 col-md-offset-2 col-sm-12">
<h3 class="mb8">Now, let's run the sample programs!</h3>
<pre>go run clients/reflect.go reflectService {{ .Name }}.jwt
go run clients/math.go httpService {{ .Name }}.jwt 1 + 2
go run clients/curlz.go httpService {{ .Name }}.jwt</pre>
<h3 class="mb8">Now, run one of the sample programs!</h3>
<p style="text-align: left">Reflect Example:</p>
<pre>go run clients/reflect.go {{ .ReflectSvc }} {{ .Name }}.jwt</pre>
<p style="text-align: left">HTTP Examples:</p>
<pre>go run clients/math.go {{ .HttpSvc }} {{ .Name }}.jwt 1 + 2
-- or --
go run clients/curlz.go {{ .HttpSvc }} {{ .Name }}.jwt</pre>
</div>
<div class="col-md-8 col-md-offset-2 col-sm-12">
<img src="./overview.png" style="background: #f5f5f5; width: 97%;padding: 10px;border-radius: 10px;">
<img src="overview.png" style="background: #f5f5f5; width: 97%;padding: 10px;border-radius: 10px;">
</div>
</div>
</div>
Expand Down Expand Up @@ -1357,6 +1367,16 @@ <h3 class="mb8">Now, let's run the sample programs!</h3>
<!--Content ends-->
<!-- partial -->

<div class="page-wrapper bg-img-1">
<span style="color: whitesmoke; font-weight: bold;">Realtime "Reflect" Messages</span>
<div class="messagebox">
<div class="innerMsgBox">
<div id="bubs" class="chat-bubbles">

</div>
</div>
</div>
</div>
</body>

</html>
5 changes: 5 additions & 0 deletions http_content/analytics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-2WJQ4K5W3C');
47 changes: 47 additions & 0 deletions http_content/chat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

function fadeOutElement(element, duration) {
var opacity = 1;
var interval = 5;
var step = (interval / duration);

var fadeOut = setInterval(function() {
if (opacity <= 0.05) {
clearInterval(fadeOut);
element.style.display = 'none';
} else {
opacity -= step;
element.style.opacity = opacity;
}
}, interval);
}

function notifyHandler(event) {
const parts = event.data.split(':');
const who = parts[0];
const what = parts.slice(1).join(':');

let d = document.createElement("div");
d.className = "chat";
d.innerHTML = "<p class=\"chatter\">" + who + "</p><p class=\"comment\">" + what + "</p>";

let bubs = document.getElementById("bubs");
bubs.append(d);
setTimeout(fadeOutElement, 10000, d, 1000);
}

if(typeof(EventSource) !== "undefined") {
let source = new EventSource("sse");

source.onerror = function(event) {
if (event.readyState === EventSource.CLOSED) {
// Connection was closed, attempt to reconnect after a delay
setTimeout(function() {
source = new EventSource('/sse'); // Re-establish the connection
}, 2000); // Adjust the delay as needed
}
};

source.addEventListener('notify', notifyHandler, false);
} else {
document.getElementById("result").innerHTML = "Sorry, your browser does not support server-sent events...";
}
Binary file added http_content/favicon.ico
Binary file not shown.
6 changes: 4 additions & 2 deletions index.html → http_content/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<html lang="en">

<head>
<title>DemoApp</title>
<title>OpenZiti Appetizer</title>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-2WJQ4K5W3C"></script>
<script src="analytics.js"></script>
<meta charset="UTF-8">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Russo+One" rel="stylesheet" />
Expand Down Expand Up @@ -229,7 +231,7 @@
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
}


button[name='dont']:hover {
outline: 0 !important;
Expand Down
25 changes: 25 additions & 0 deletions http_content/messages.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script async src="https://www.googletagmanager.com/gtag/js?id=G-2WJQ4K5W3C"></script>
<script src="analytics.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="./reflectMessages.css">
<script src="chat.js"></script>
</head>
<body class="bg-img-1">
<div class="page-wrapper bg-img-1">
<p style="color: whitesmoke">Realtime "Reflect" Messages Page</p>
<div class="messagebox">
<div class="innerMsgBox">
<div id="bubs" class="chat-bubbles">

</div>
</div>
</div>
</div>
</body>
</html>
File renamed without changes
File renamed without changes
Loading

0 comments on commit ae10975

Please sign in to comment.