MCPcopy Create free account
hub / github.com/AdRoll/baker / Run

Method Run

output/websocket.go:48–67  ·  view source on GitHub ↗

websocket server

(input <-chan baker.OutputRecord, _ chan<- string)

Source from the content-addressed store, hash-verified

46// websocket server
47
48func (w *WebSocket) Run(input <-chan baker.OutputRecord, _ chan<- string) error {
49 cfg := websocket.Conf{
50 Fields: w.Fields,
51 FieldByName: w.fieldByName,
52 }
53 server := websocket.NewServer(cfg)
54 go server.Listen()
55
56 go func() {
57 log.Fatal(http.ListenAndServe(":8080", nil))
58 }()
59
60 log.Info("WS Ready to receive records")
61 for lldata := range input {
62 server.SendAll(lldata.Fields)
63 atomic.AddInt64(&w.totaln, int64(1))
64 }
65
66 return nil
67}
68
69func (w *WebSocket) Stats() baker.OutputStats {
70 return baker.OutputStats{

Callers

nothing calls this directly

Calls 3

ListenMethod · 0.95
SendAllMethod · 0.95
NewServerFunction · 0.92

Tested by

no test coverage detected