client

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2019 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Write(res *model.Message)
	Read(cb DataCallback)
	RoutineWrite()
	ClientID() string
	Close()

	Context() context.Context
}

Client is the inteface for the websocket and grpc sockets

type DataCallback

type DataCallback func(data *model.Message) bool

DataCallback is the callback invoked when data is read by the socket

type GRPCRealtimeClient

type GRPCRealtimeClient struct {
	// contains filtered or unexported fields
}

GRPCRealtimeClient is the object handling all client interactions

func CreateGRPCRealtimeClient

func CreateGRPCRealtimeClient(stream proto.SpaceCloud_RealTimeServer) *GRPCRealtimeClient

CreateGRPCRealtimeClient makes a client object to manage the grpc

func (*GRPCRealtimeClient) ClientID

func (c *GRPCRealtimeClient) ClientID() string

ClientID returns the client's id

func (*GRPCRealtimeClient) Close

func (c *GRPCRealtimeClient) Close()

Close closes the client

func (*GRPCRealtimeClient) Context

func (c *GRPCRealtimeClient) Context() context.Context

Context returns the client's context

func (*GRPCRealtimeClient) Read

func (c *GRPCRealtimeClient) Read(cb DataCallback)

Read startes a blocking reader routine

func (*GRPCRealtimeClient) RoutineWrite

func (c *GRPCRealtimeClient) RoutineWrite()

RoutineWrite starts a json writer routine

func (*GRPCRealtimeClient) Write

func (c *GRPCRealtimeClient) Write(res *model.Message)

Write wrties the object to the client

type GRPCServiceClient

type GRPCServiceClient struct {
	// contains filtered or unexported fields
}

GRPCServiceClient is the object handling all client interactions

func CreateGRPCServiceClient

func CreateGRPCServiceClient(stream proto.SpaceCloud_ServiceServer) *GRPCServiceClient

CreateGRPCServiceClient makes a client object to manage the grpc

func (*GRPCServiceClient) ClientID

func (c *GRPCServiceClient) ClientID() string

ClientID returns the client's id

func (*GRPCServiceClient) Close

func (c *GRPCServiceClient) Close()

Close closes the client

func (*GRPCServiceClient) Context

func (c *GRPCServiceClient) Context() context.Context

Context returns the client's context

func (*GRPCServiceClient) Read

func (c *GRPCServiceClient) Read(cb DataCallback)

Read startes a blocking reader routine

func (*GRPCServiceClient) RoutineWrite

func (c *GRPCServiceClient) RoutineWrite()

RoutineWrite starts a json writer routine

func (*GRPCServiceClient) Write

func (c *GRPCServiceClient) Write(res *model.Message)

Write wrties the object to the client

type WebsocketClient

type WebsocketClient struct {
	// contains filtered or unexported fields
}

WebsocketClient is the websocket client

func CreateWebsocketClient

func CreateWebsocketClient(socket *websocket.Conn) *WebsocketClient

CreateWebsocketClient makes a client object to manage the socket

func (*WebsocketClient) ClientID

func (c *WebsocketClient) ClientID() string

ClientID returns the client's id

func (*WebsocketClient) Close

func (c *WebsocketClient) Close()

Close closes the client

func (*WebsocketClient) Context

func (c *WebsocketClient) Context() context.Context

Context returns the client's context

func (*WebsocketClient) Read

func (c *WebsocketClient) Read(cb DataCallback)

Read starts a blocking reader routine

func (*WebsocketClient) RoutineWrite

func (c *WebsocketClient) RoutineWrite()

RoutineWrite starts a json writer routine

func (*WebsocketClient) Write

func (c *WebsocketClient) Write(res *model.Message)

Write writes the object to the client

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL