WebSocket errors

Technical reference of Errores WebSocket.

This API is used in WebSocket Life Cycle.


Symbols

SymbolClassDescription
GoxSocketErrorCodetypeGoxSocketErrorCode defines a public type of API.
GoxSocketTransportErrorconstGoxSocketTransportError defines a constant value of the API.
GoxSocketConnectionClosedconstGoxSocketConnectionClosed defines a constant value of the API.
GoxSocketProtocolErrorconstGoxSocketProtocolError defines a constant value of the API.
GoxSocketErrorPhasetypeGoxSocketErrorPhase defines a public type of API.
GoxSocketErrortypeGoxSocketError defines a public type of API.
GoxSocketError.ErrorfuncReturns the textual representation of the error.
NewGoxSocketErrorfuncBuild NewGoxSocketError.
ChannelErrorCodetypeChannelErrorCode defines a public type of API.
ChannelProtocolErrorconstChannelProtocolError defines a constant value of the API.
ChannelTransportErrorconstChannelTransportError defines a constant value of the API.
ChannelErrortypeChannelError defines a public type of API.
ChannelError.ErrorfuncReturns the textual representation of the error.
ChannelDisconnectReasontypeChannelDisconnectReason defines a public type of API.
ChannelDisconnectLeftconstChannelDisconnectLeft defines a constant value of the API.
ChannelDisconnectRemovedconstChannelDisconnectRemoved defines a constant value of the API.
ChannelDisconnectRejectedconstChannelDisconnectRejected defines a constant value of the API.
ChannelDisconnectSocketDisconnectedconstChannelDisconnectSocketDisconnected defines a constant value of the API.
ChannelDisconnectClosedconstChannelDisconnectClosed defines a constant value of the API.
ChannelDisconnectServerStoppedconstChannelDisconnectServerStopped defines a constant value of the API.
WSCloseCodetypeWSCloseCode defines a public type of API.
WSCloseDefaultconstWSCloseDefault defines a constant value of the API.
WSCloseNormalconstWSCloseNormal defines a constant value of the API.
WSCloseGoingAwayconstWSCloseGoingAway defines a constant value of the API.
WSCloseProtocolconstWSCloseProtocol defines a constant value of the API.
WSCloseUnsupportedconstWSCloseUnsupported defines a constant value of the API.
WSCloseAbnormalconstWSCloseAbnormal defines a constant value of the API.
WSCloseInvalidDataconstWSCloseInvalidData defines a constant value of the API.
WSClosePolicyconstWSClosePolicy defines a constant value of the API.
WSCloseMessageLargeconstWSCloseMessageLarge defines a constant value of the API.
WSCloseInternalconstWSCloseInternal defines a constant value of the API.
WSCloseRestartconstWSCloseRestart defines a constant value of the API.
WSCloseTryLaterconstWSCloseTryLater defines a constant value of the API.
WSClosePermanentconstWSClosePermanent defines a constant value of the API.
WSCloseReconnectconstWSCloseReconnect defines a constant value of the API.
WSCloseSessionExpiredconstWSCloseSessionExpired defines a constant value of the API.
WSCloseSessionDestroyedconstWSCloseSessionDestroyed defines a constant value of the API.
WSCloseReasonfuncReturns the default reason for a closing code.
WSDisconnectInitiatortypeWSDisconnectInitiator defines a public type of API.
WSDisconnectInitiatorClientconstWSDisconnectInitiatorClient defines a constant value of the API.
WSDisconnectInitiatorServerconstWSDisconnectInitiatorServer defines a constant value of the API.
WSDisconnectInitiatorUnknownconstWSDisconnectInitiatorUnknown defines a constant value of the API.
WSDisconnectReasontypeWSDisconnectReason defines a public type of API.

GoxSocketErrorCode

Declaration:

gox
type GoxSocketErrorCode string

GoxSocketErrorCode defines a public type of API.


GoxSocketTransportError

Declaration:

gox
GoxSocketTransportError        GoxSocketErrorCode = "TRANSPORT_ERROR"

GoxSocketTransportError defines a constant value of the API.


GoxSocketConnectionClosed

Declaration:

gox
GoxSocketConnectionClosed      GoxSocketErrorCode = "CONNECTION_CLOSED"

GoxSocketConnectionClosed defines a constant value of the API.


GoxSocketProtocolError

Declaration:

gox
GoxSocketProtocolError         GoxSocketErrorCode = "PROTOCOL_ERROR"

GoxSocketProtocolError defines a constant value of the API.


GoxSocketErrorPhase

Declaration:

gox
type GoxSocketErrorPhase string

GoxSocketErrorPhase defines a public type of API.


GoxSocketError

Declaration:

gox
type GoxSocketError struct {
	Code      GoxSocketErrorCode
	Message   string
	Phase     GoxSocketErrorPhase
	Event     string
	Retryable bool
	Cause     error
	EventID   uint64
	Argument  int
	Received  string
	Expected  string
	Remote    bool
}

GoxSocketError defines a public type of API.

Fields

FieldTypeDescription
CodeGoxSocketErrorCodeCode that classifies the state.
MessagestringA descriptive message.
PhaseGoxSocketErrorPhasePhase that made the mistake.
EventstringName of the event.
RetryableboolIt indicates whether the operation can be retried.
Causeerrorunderlying error.
EventIDuint64Associated identifier.
ArgumentintInvalid argument index.
ReceivedstringType or value received.
ExpectedstringExpected type or value.
RemoteboolIt indicates whether the error originated in another instance.

GoxSocketError.Error

Declaration:

gox
func (err GoxSocketError) Error() string

Returns the textual representation of the error.

Returns

ReturnTypeDescription
valuestringTextual value produced by the operation; its zero value is an empty string.

Usage syntax

gox
value := goxSocketError.Error()

NewGoxSocketError

Declaration:

gox
func NewGoxSocketError(code GoxSocketErrorCode, message string, phase GoxSocketErrorPhase, event string, retryable bool, cause error) GoxSocketError

Build NewGoxSocketError.

Parameters

ParameterTypeDescription
codeGoxSocketErrorCodeCode of closure.
messagestringType value string required by the operation.
phaseGoxSocketErrorPhaseType value GoxSocketErrorPhase required by the operation.
eventstringName of the event.
retryableboolType value bool required by the operation.
causeerrorType value error required by the operation.

Returns

ReturnTypeDescription
valueGoxSocketErrorType value GoxSocketError produced by the operation.

Usage syntax

gox
value := gox.NewGoxSocketError(200, value, value, "event", value, value)

ChannelErrorCode

Declaration:

gox
type ChannelErrorCode string

ChannelErrorCode defines a public type of API.


ChannelProtocolError

Declaration:

gox
ChannelProtocolError  ChannelErrorCode = "PROTOCOL_ERROR"

ChannelProtocolError defines a constant value of the API.


ChannelTransportError

Declaration:

gox
ChannelTransportError ChannelErrorCode = "TRANSPORT_ERROR"

ChannelTransportError defines a constant value of the API.


ChannelError

Declaration:

gox
type ChannelError struct {
	Code      ChannelErrorCode
	ChannelID string
	Event     string
	Message   string
	Retryable bool
	Cause     error
}

ChannelError defines a public type of API.

Fields

FieldTypeDescription
CodeChannelErrorCodeCode that classifies the state.
ChannelIDstringAssociated identifier.
EventstringName of the event.
MessagestringA descriptive message.
RetryableboolIt indicates whether the operation can be retried.
Causeerrorunderlying error.

ChannelError.Error

Declaration:

gox
func (err ChannelError) Error() string

Returns the textual representation of the error.

Returns

ReturnTypeDescription
valuestringTextual value produced by the operation; its zero value is an empty string.

Usage syntax

gox
value := channelError.Error()

ChannelDisconnectReason

Declaration:

gox
type ChannelDisconnectReason string

ChannelDisconnectReason defines a public type of API.


ChannelDisconnectLeft

Declaration:

gox
ChannelDisconnectLeft               ChannelDisconnectReason = "left"

ChannelDisconnectLeft defines a constant value of the API.


ChannelDisconnectRemoved

Declaration:

gox
ChannelDisconnectRemoved            ChannelDisconnectReason = "removed"

ChannelDisconnectRemoved defines a constant value of the API.


ChannelDisconnectRejected

Declaration:

gox
ChannelDisconnectRejected           ChannelDisconnectReason = "rejected"

ChannelDisconnectRejected defines a constant value of the API.


ChannelDisconnectSocketDisconnected

Declaration:

gox
ChannelDisconnectSocketDisconnected ChannelDisconnectReason = "socket-disconnected"

ChannelDisconnectSocketDisconnected defines a constant value of the API.


ChannelDisconnectClosed

Declaration:

gox
ChannelDisconnectClosed             ChannelDisconnectReason = "closed"

ChannelDisconnectClosed defines a constant value of the API.


ChannelDisconnectServerStopped

Declaration:

gox
ChannelDisconnectServerStopped      ChannelDisconnectReason = "server-stopped"

ChannelDisconnectServerStopped defines a constant value of the API.


WSCloseCode

Declaration:

gox
type WSCloseCode int

WSCloseCode defines a public type of API.


WSCloseDefault

Declaration:

gox
WSCloseDefault      WSCloseCode = 0

WSCloseDefault defines a constant value of the API.


WSCloseNormal

Declaration:

gox
WSCloseNormal       WSCloseCode = 1000

WSCloseNormal defines a constant value of the API.


WSCloseGoingAway

Declaration:

gox
WSCloseGoingAway    WSCloseCode = 1001

WSCloseGoingAway defines a constant value of the API.


WSCloseProtocol

Declaration:

gox
WSCloseProtocol     WSCloseCode = 1002

WSCloseProtocol defines a constant value of the API.


WSCloseUnsupported

Declaration:

gox
WSCloseUnsupported  WSCloseCode = 1003

WSCloseUnsupported defines a constant value of the API.


WSCloseAbnormal

Declaration:

gox
WSCloseAbnormal     WSCloseCode = 1006

WSCloseAbnormal defines a constant value of the API.


WSCloseInvalidData

Declaration:

gox
WSCloseInvalidData  WSCloseCode = 1007

WSCloseInvalidData defines a constant value of the API.


WSClosePolicy

Declaration:

gox
WSClosePolicy       WSCloseCode = 1008

WSClosePolicy defines a constant value of the API.


WSCloseMessageLarge

Declaration:

gox
WSCloseMessageLarge WSCloseCode = 1009

WSCloseMessageLarge defines a constant value of the API.


WSCloseInternal

Declaration:

gox
WSCloseInternal     WSCloseCode = 1011

WSCloseInternal defines a constant value of the API.


WSCloseRestart

Declaration:

gox
WSCloseRestart      WSCloseCode = 1012

WSCloseRestart defines a constant value of the API.


WSCloseTryLater

Declaration:

gox
WSCloseTryLater     WSCloseCode = 1013

WSCloseTryLater defines a constant value of the API.


WSClosePermanent

Declaration:

gox
WSClosePermanent        WSCloseCode = 4000

WSClosePermanent defines a constant value of the API.


WSCloseReconnect

Declaration:

gox
WSCloseReconnect        WSCloseCode = 4001

WSCloseReconnect defines a constant value of the API.


WSCloseSessionExpired

Declaration:

gox
WSCloseSessionExpired   WSCloseCode = 4002

WSCloseSessionExpired defines a constant value of the API.


WSCloseSessionDestroyed

Declaration:

gox
WSCloseSessionDestroyed WSCloseCode = 4003

WSCloseSessionDestroyed defines a constant value of the API.


WSCloseReason

Declaration:

gox
func WSCloseReason(code WSCloseCode) string

Returns the default reason for a closing code.

Parameters

ParameterTypeDescription
codeWSCloseCodeCode of closure.

Returns

ReturnTypeDescription
valuestringTextual value produced by the operation; its zero value is an empty string.

Usage syntax

gox
value := gox.WSCloseReason(gox.WSCloseNormal)

WSDisconnectInitiator

Declaration:

gox
type WSDisconnectInitiator string

WSDisconnectInitiator defines a public type of API.


WSDisconnectInitiatorClient

Declaration:

gox
WSDisconnectInitiatorClient  WSDisconnectInitiator = "client"

WSDisconnectInitiatorClient defines a constant value of the API.


WSDisconnectInitiatorServer

Declaration:

gox
WSDisconnectInitiatorServer  WSDisconnectInitiator = "server"

WSDisconnectInitiatorServer defines a constant value of the API.


WSDisconnectInitiatorUnknown

Declaration:

gox
WSDisconnectInitiatorUnknown WSDisconnectInitiator = "unknown"

WSDisconnectInitiatorUnknown defines a constant value of the API.


WSDisconnectReason

Declaration:

gox
type WSDisconnectReason struct {
	Code          WSCloseCode
	Reason        string
	Clean         bool
	Initiator     WSDisconnectInitiator
	WillReconnect bool
}

WSDisconnectReason defines a public type of API.

Fields

FieldTypeDescription
CodeWSCloseCodeCode that classifies the state.
ReasonstringAssociated reason.
CleanboolIt indicates whether the closure completed the handshake.
InitiatorWSDisconnectInitiatorPart that started the disconnection.
WillReconnectboolIt indicates whether there will be automatic reconnection.

See also

Next step

Continue with configuration of the server package.

server package