func NoPayload()

in websocketserver/handlers.go [19:29]


func NoPayload(f handlerWithoutPayload) handlerWithPayload {
	return func(c *websocket.Conn, mustBeEmpty json.RawMessage) *common.Response {
		var jsonNull = json.RawMessage("null")
		// Check that mustBeNil is nil, send an error response if not
		if mustBeEmpty != nil && len(mustBeEmpty) > 0 && !bytes.Equal(mustBeEmpty, jsonNull) {
			return &common.Response{StatusCode: http.StatusBadRequest, ErrorMessage: "protocol error"}
		}

		return f(c)
	}
}