check origin unnecessary for demo
This commit is contained in:
		
							
								
								
									
										7
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								main.go
									
									
									
									
									
								
							@@ -42,12 +42,15 @@ func load_data(filename string) []dashData {
 | 
				
			|||||||
	return d
 | 
						return d
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var upgrader = websocket.Upgrader{}
 | 
					var upgrader = websocket.Upgrader{
 | 
				
			||||||
 | 
						CheckOrigin: func(r *http.Request) bool {
 | 
				
			||||||
 | 
							return true
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func main() {
 | 
					func main() {
 | 
				
			||||||
	http.HandleFunc("/ws", subscribe)
 | 
						http.HandleFunc("/ws", subscribe)
 | 
				
			||||||
	log.Fatal(http.ListenAndServe("localhost:9888", nil))
 | 
						log.Fatal(http.ListenAndServe("localhost:9888", nil))
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func subscribe(w http.ResponseWriter, r *http.Request) {
 | 
					func subscribe(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user