File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 1
1
< html >
2
2
< head >
3
3
< 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 >
5
5
< script type ="text/javascript ">
6
6
$ ( function ( ) {
7
7
31
31
} ) ;
32
32
33
33
if ( window [ "WebSocket" ] ) {
34
- conn = new WebSocket ( "ws ://{{$}}/ws" ) ;
34
+ conn = new WebSocket ( "wss ://{{$}}/ws" ) ;
35
35
conn . onclose = function ( evt ) {
36
36
appendLog ( $ ( "<div><b>Connection closed.</b></div>" ) )
37
37
}
Original file line number Diff line number Diff line change @@ -165,6 +165,19 @@ func main() {
165
165
166
166
log .Println ("The Serial Port JSON Server is now running." )
167
167
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
+ }
168
181
169
182
// see if they provided a regex filter
170
183
if len (* regExpFilter ) > 0 {
@@ -264,7 +277,7 @@ const homeTemplateHtml = `<!DOCTYPE html>
264
277
<html>
265
278
<head>
266
279
<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>
268
281
<script type="text/javascript">
269
282
$(function() {
270
283
You can’t perform that action at this time.
0 commit comments