channel

package
v0.20.0-alpha8 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2016 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package channel implements the server side of App Engine's Channel API.

Create creates a new channel associated with the given clientID, which must be unique to the client that will use the returned token.

token, err := channel.Create(c, "player1")
if err != nil {
	// handle error
}
// return token to the client in an HTTP response

Send sends a message to the client over the channel identified by clientID.

channel.Send(c, "player1", "Game over!")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(c context.Context, clientID string) (token string, err error)

Create creates a channel and returns a token for use by the client. The clientID is an application-provided string used to identify the client.

func Send

func Send(c context.Context, clientID, message string) error

Send sends a message on the channel associated with clientID.

func SendJSON

func SendJSON(c context.Context, clientID string, value interface{}) error

SendJSON is a helper function that sends a JSON-encoded value on the channel associated with clientID.

Types

This section is empty.

Jump to

Keyboard shortcuts

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