Beispiel #1
0
func (w *WebsocketServer) streamLogs(appId string, ws *gorilla.Conn) {
	w.logger.Debugf("WebsocketServer: Requesting a wss sink for app %s", appId)
	websocketSink := websocket.NewWebsocketSink(
		appId,
		w.logger,
		ws,
		w.bufferSize,
	)

	w.sinkManager.RegisterSink(websocketSink)
	defer w.sinkManager.UnregisterSink(websocketSink)

	go ws.ReadMessage()
	server.NewKeepAlive(ws, w.keepAliveInterval).Run()
}
Beispiel #2
0
	return fake.messages
}

var _ = Describe("WebsocketSink", func() {

	var (
		logger        *gosteno.Logger
		websocketSink *websocket.WebsocketSink
		fakeWebsocket *fakeMessageWriter
	)

	BeforeEach(func() {
		logger = loggertesthelper.Logger()
		fakeWebsocket = &fakeMessageWriter{}
		websocketSink = websocket.NewWebsocketSink("appId", logger, fakeWebsocket, 10)
	})

	Describe("Identifier", func() {
		It("returns the remote address", func() {
			Expect(websocketSink.Identifier()).To(Equal("RemoteAddressString"))
		})
	})

	Describe("AppId", func() {
		It("returns the application id", func() {
			Expect(websocketSink.AppId()).To(Equal("appId"))
		})
	})

	Describe("ShouldReceiveErrors", func() {