Documentation
¶
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) ConsensusStatus(ctx context.Context, opts api.ConsensusStatusOptions) (*api.ConsensusStatus, error)
- func (c *Client) Done() <-chan struct{}
- func (c *Client) Faucet(ctx context.Context, account *url.URL, opts api.FaucetOptions) (*api.Submission, error)
- func (c *Client) FindService(ctx context.Context, opts api.FindServiceOptions) ([]*api.FindServiceResult, error)
- func (c *Client) Metrics(ctx context.Context, opts api.MetricsOptions) (*api.Metrics, error)
- func (c *Client) NetworkStatus(ctx context.Context, opts api.NetworkStatusOptions) (*api.NetworkStatus, error)
- func (c *Client) NodeInfo(ctx context.Context, opts api.NodeInfoOptions) (*api.NodeInfo, error)
- func (c *Client) Query(ctx context.Context, scope *url.URL, query api.Query) (api.Record, error)
- func (c *Client) Submit(ctx context.Context, envelope *messaging.Envelope, opts api.SubmitOptions) ([]*api.Submission, error)
- func (c *Client) Subscribe(ctx context.Context, opts api.SubscribeOptions) (<-chan api.Event, error)
- func (c *Client) Validate(ctx context.Context, envelope *messaging.Envelope, opts api.ValidateOptions) ([]*api.Submission, error)
- type Handler
- type Message
- func (v *Message) Copy() *Message
- func (v *Message) CopyAsInterface() interface{}
- func (v *Message) Equal(u *Message) bool
- func (v *Message) IsValid() error
- func (v *Message) MarshalBinary() ([]byte, error)
- func (v *Message) MarshalJSON() ([]byte, error)
- func (v *Message) UnmarshalBinary(data []byte) error
- func (v *Message) UnmarshalBinaryFrom(rd io.Reader) error
- func (v *Message) UnmarshalJSON(data []byte) error
- type StreamStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a WebSocket message transport client for API v3.
func (*Client) ConsensusStatus ¶
func (c *Client) ConsensusStatus(ctx context.Context, opts api.ConsensusStatusOptions) (*api.ConsensusStatus, error)
ConsensusStatus implements api.ConsensusService.ConsensusStatus.
func (*Client) Done ¶
func (c *Client) Done() <-chan struct{}
Done returns a channel that will be closed once the client is closed.
func (*Client) Faucet ¶
func (c *Client) Faucet(ctx context.Context, account *url.URL, opts api.FaucetOptions) (*api.Submission, error)
Faucet implements api.Faucet.Faucet.
func (*Client) FindService ¶
func (c *Client) FindService(ctx context.Context, opts api.FindServiceOptions) ([]*api.FindServiceResult, error)
FindService implements api.NodeService.FindService.
func (*Client) Metrics ¶
Metrics implements api.MetricsService.Metrics.
func (*Client) NetworkStatus ¶
func (c *Client) NetworkStatus(ctx context.Context, opts api.NetworkStatusOptions) (*api.NetworkStatus, error)
NetworkStatus implements api.NetworkService.NetworkStatus.
func (*Client) NodeInfo ¶
NodeInfo implements api.NodeService.NodeInfo.
func (*Client) Query ¶
Query implements api.Querier.Query.
func (*Client) Submit ¶
func (c *Client) Submit(ctx context.Context, envelope *messaging.Envelope, opts api.SubmitOptions) ([]*api.Submission, error)
Submit implements api.Submitter.Submit.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles WebSocket connections.
func NewHandler ¶
NewHandler constructs a new Handler with the given list of services. NewHandler only returns an error if more than one service attempts to register a method for the same request type.
func (*Handler) FallbackTo ¶
FallbackTo returns an http.Handler that falls back to the given handler if the request is not a websocket request. This allows the WebSocket services to coexist with traditional HTTP services.
func (*Handler) ServeHTTP ¶
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler.
type Message ¶
type Message struct { ID uint64 `json:"id,omitempty" form:"id" query:"id" validate:"required"` Status StreamStatus `json:"status,omitempty" form:"status" query:"status" validate:"required"` Message message.Message `json:"message,omitempty" form:"message" query:"message"` // contains filtered or unexported fields }
func (*Message) CopyAsInterface ¶
func (v *Message) CopyAsInterface() interface{}
func (*Message) MarshalBinary ¶
func (*Message) MarshalJSON ¶
func (*Message) UnmarshalBinary ¶
func (*Message) UnmarshalJSON ¶
type StreamStatus ¶
type StreamStatus int
StreamStatus indicates the status of a sub-stream.
const StreamStatusClosed StreamStatus = 2
StreamStatusClosed .
const StreamStatusOpen StreamStatus = 1
StreamStatusOpen .
func StreamStatusByName ¶
func StreamStatusByName(name string) (StreamStatus, bool)
StreamStatusByName returns the named Stream Status.
func (StreamStatus) GetEnumValue ¶
func (v StreamStatus) GetEnumValue() uint64
GetEnumValue returns the value of the Stream Status
func (StreamStatus) MarshalJSON ¶
func (v StreamStatus) MarshalJSON() ([]byte, error)
MarshalJSON marshals the Stream Status to JSON as a string.
func (*StreamStatus) SetEnumValue ¶
func (v *StreamStatus) SetEnumValue(id uint64) bool
SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.
func (StreamStatus) String ¶
func (v StreamStatus) String() string
String returns the name of the Stream Status.
func (*StreamStatus) UnmarshalJSON ¶
func (v *StreamStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the Stream Status from JSON as a string.