Skip to content

Commit 5f3ef3d

Browse files
committed
Back to http
Former-commit-id: 99ac0a401449375d0e43067a46113cd3acdacc5b [formerly a3f9f992097ebd3350a25dbb8cebbc37f4b80150] Former-commit-id: 57d837f8759a29a88c7235265b496d9346206124
1 parent fca95cc commit 5f3ef3d

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

home.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<html>
22
<head>
33
<title>Serial Port Example</title>
4-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
4+
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
55
<script type="text/javascript">
66
$(function() {
77

@@ -31,7 +31,7 @@
3131
});
3232

3333
if (window["WebSocket"]) {
34-
conn = new WebSocket("ws://{{$}}/ws");
34+
conn = new WebSocket("wss://{{$}}/ws");
3535
conn.onclose = function(evt) {
3636
appendLog($("<div><b>Connection closed.</b></div>"))
3737
}

main.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,19 @@ func main() {
165165

166166
log.Println("The Serial Port JSON Server is now running.")
167167
log.Println("If you are using ChiliPeppr, you may go back to it and connect to this server.")
168+
// launch the hub routine which is the singleton for the websocket server
169+
go h.run()
170+
// launch our serial port routine
171+
go sh.run()
172+
// launch our dummy data routine
173+
//go d.run()
174+
175+
http.HandleFunc("/", homeHandler)
176+
http.HandleFunc("/ws", wsHandler)
177+
if err := http.ListenAndServe(*addr, nil); err != nil {
178+
fmt.Printf("Error trying to bind to port: %v, so exiting...", err)
179+
log.Fatal("Error ListenAndServe:", err)
180+
}
168181

169182
// see if they provided a regex filter
170183
if len(*regExpFilter) > 0 {
@@ -264,7 +277,7 @@ const homeTemplateHtml = `<!DOCTYPE html>
264277
<html>
265278
<head>
266279
<title>Serial Port Example</title>
267-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
280+
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
268281
<script type="text/javascript">
269282
$(function() {
270283

0 commit comments

Comments
 (0)