request

package
v0.0.0-...-1293670 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2016 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncSender

type AsyncSender interface {
	SendAsync(msg dtos.WebSocketMessage) <-chan error
}

AsyncSender allows asynchronous sending of messages

type AsyncSenderCloser

type AsyncSenderCloser interface {
	AsyncSender
	Close()
}

AsyncSenderCloser represents a type that allows asynchronous sending of messages and closing the connection.

type Context

type Context struct {
	AsyncSenderCloser
	// contains filtered or unexported fields
}

Context stores session context

func NewContext

func NewContext(c AsyncSenderCloser) *Context

NewContext constructs a new valid Context object

func (*Context) GetRequest

func (c *Context) GetRequest(requestID int64) (channel chan<- dtos.WebSocketMessage, ok bool)

GetRequest retrieves the channel associated with the request identified by the provided requestID. If the request has not been found or has already been retrieved the ok return value is set to false.

func (*Context) GetSessionData

func (c *Context) GetSessionData(key string) (data interface{}, ok bool)

GetSessionData retrieves a value from this session context

func (*Context) NewRequest

func (c *Context) NewRequest() (int64, <-chan dtos.WebSocketMessage)

NewRequest registers a new request to be sent. The returned channel is used to receive the incoming response. The ID returned from this function has to be used as the value for WebSocketMessage.RequestID.

func (*Context) OnClose

func (c *Context) OnClose()

OnClose is called when the underlying connection is closed. It performs the necessary context cleanup.

func (*Context) SetSessionData

func (c *Context) SetSessionData(key string, data interface{})

SetSessionData stores a value in this session context

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳