Documentation ¶
Index ¶
- Variables
- func JsonMarshall(payload interface{}) json.RawMessage
- type WebsocketConnection
- type WebsocketConnectionMock
- func (mock *WebsocketConnectionMock) Close() error
- func (mock *WebsocketConnectionMock) OnClose(returnedError error)
- func (mock *WebsocketConnectionMock) OnReadCompressedMessage(data []byte, returnedError error)
- func (mock *WebsocketConnectionMock) OnReadTextMessage(data []byte, returnedError error)
- func (wsMock *WebsocketConnectionMock) OnWriteAnyMessage(returnedError error)
- func (mock *WebsocketConnectionMock) OnWriteCompressedMessage(data []byte, returnedError error)
- func (mock *WebsocketConnectionMock) OnWriteTextMessage(data []byte, returnedError error)
- func (mock *WebsocketConnectionMock) ReadMessage() (messageType int, response []byte, err error)
- func (mock *WebsocketConnectionMock) SimulateErrorResponse(request interface{}, exception types.Exception)
- func (wsMock *WebsocketConnectionMock) SimulateErrorResponseOnAnyMessage(exception types.Exception)
- func (mock *WebsocketConnectionMock) SimulateOKResponse(request interface{}, response interface{})
- func (wsMock *WebsocketConnectionMock) SimulateOKResponseOnAnyMessage(response interface{})
- func (wsMock *WebsocketConnectionMock) SimulateResponse(request interface{}, response interface{})
- func (mock *WebsocketConnectionMock) SimulateSQLQueriesResponse(request interface{}, results interface{})
- func (wsMock *WebsocketConnectionMock) SimulateWriteFails(request interface{}, err error)
- func (mock *WebsocketConnectionMock) WriteMessage(messageType int, data []byte) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func JsonMarshall ¶
func JsonMarshall(payload interface{}) json.RawMessage
Types ¶
type WebsocketConnection ¶
type WebsocketConnection interface { // WriteMessage is a helper method for getting a writer using NextWriter, // writing the message and closing the writer. WriteMessage(messageType int, data []byte) error // ReadMessage is a helper method for getting a reader using NextReader and // reading from that reader to a buffer. ReadMessage() (messageType int, p []byte, err error) // Close closes the underlying network connection without sending or waiting for a close message. Close() error }
WebsocketConnection is a thin wrapper around websocket.Conn that allows mocking a websocket connection during unit tests.
func CreateConnection ¶
func CreateConnection(ctx context.Context, skipVerify bool, expectedFingerprint string, url url.URL) (WebsocketConnection, error)
CreateConnection creates a websocket connection to the given URL. This deactivates write compression for the new connection.
type WebsocketConnectionMock ¶
func CreateWebsocketConnectionMock ¶
func CreateWebsocketConnectionMock() *WebsocketConnectionMock
func (*WebsocketConnectionMock) Close ¶
func (mock *WebsocketConnectionMock) Close() error
func (*WebsocketConnectionMock) OnClose ¶
func (mock *WebsocketConnectionMock) OnClose(returnedError error)
func (*WebsocketConnectionMock) OnReadCompressedMessage ¶
func (mock *WebsocketConnectionMock) OnReadCompressedMessage(data []byte, returnedError error)
func (*WebsocketConnectionMock) OnReadTextMessage ¶
func (mock *WebsocketConnectionMock) OnReadTextMessage(data []byte, returnedError error)
func (*WebsocketConnectionMock) OnWriteAnyMessage ¶
func (wsMock *WebsocketConnectionMock) OnWriteAnyMessage(returnedError error)
func (*WebsocketConnectionMock) OnWriteCompressedMessage ¶
func (mock *WebsocketConnectionMock) OnWriteCompressedMessage(data []byte, returnedError error)
func (*WebsocketConnectionMock) OnWriteTextMessage ¶
func (mock *WebsocketConnectionMock) OnWriteTextMessage(data []byte, returnedError error)
func (*WebsocketConnectionMock) ReadMessage ¶
func (mock *WebsocketConnectionMock) ReadMessage() (messageType int, response []byte, err error)
func (*WebsocketConnectionMock) SimulateErrorResponse ¶
func (mock *WebsocketConnectionMock) SimulateErrorResponse(request interface{}, exception types.Exception)
func (*WebsocketConnectionMock) SimulateErrorResponseOnAnyMessage ¶
func (wsMock *WebsocketConnectionMock) SimulateErrorResponseOnAnyMessage(exception types.Exception)
func (*WebsocketConnectionMock) SimulateOKResponse ¶
func (mock *WebsocketConnectionMock) SimulateOKResponse(request interface{}, response interface{})
func (*WebsocketConnectionMock) SimulateOKResponseOnAnyMessage ¶
func (wsMock *WebsocketConnectionMock) SimulateOKResponseOnAnyMessage(response interface{})
func (*WebsocketConnectionMock) SimulateResponse ¶
func (wsMock *WebsocketConnectionMock) SimulateResponse(request interface{}, response interface{})
func (*WebsocketConnectionMock) SimulateSQLQueriesResponse ¶
func (mock *WebsocketConnectionMock) SimulateSQLQueriesResponse(request interface{}, results interface{})
func (*WebsocketConnectionMock) SimulateWriteFails ¶ added in v1.0.9
func (wsMock *WebsocketConnectionMock) SimulateWriteFails(request interface{}, err error)
func (*WebsocketConnectionMock) WriteMessage ¶
func (mock *WebsocketConnectionMock) WriteMessage(messageType int, data []byte) error
Click to show internal directories.
Click to hide internal directories.