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 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
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 }
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments