fayec

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 5 Imported by: 1

README

faye

faye protocol implemented in go

GoDoc

TODO

  • port complete javascript test suite to go

  • wildcard subscriptions

  • services

Documentation

Index

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 represents a client connection to an faye server.

func NewClient

func NewClient(url string, opts ...Option) (*Client, error)

NewClient creates a new faye client with the provided options and connect to the specified url.

func (*Client) Disconnect

func (c *Client) Disconnect() error

Disconnect closes all subscriptions and inform the server to remove any client-related state. any subsequent method call to the client object will result in undefined behaviour.

func (*Client) Publish

func (c *Client) Publish(channel string, authToken string, data message.Data) (err error)

Publish publishes events on a channel by sending event messages, the server MAY respond to a publish event if this feature is supported by the server use the OnPublishResponse to get the publish status.

func (*Client) Subscribe

func (c *Client) Subscribe(channel string, authToken string) (*subscription.Subscription, error)

Subscribe informs the server that messages published to that channel are delivered to itself.

type Option

type Option func(*options)

Option set the Client options, such as Transport, message extensions,etc.

func WithExtension

func WithExtension(inExt message.Extension, outExt message.Extension) Option

WithExtension append the provided incoming extension and outgoing to the list of incoming and outgoing extensions. extensions run in the order that they are provided

func WithInExtension

func WithInExtension(extension message.Extension) Option

WithInExtension append the provided incoming extension to the list of incoming extensions. extensions run in the order that they are provided

func WithOutExtension

func WithOutExtension(extension message.Extension) Option

WithOutExtension append the provided outgoing extension to the the default transport options extensions run in the order that they are provided

func WithTransport

func WithTransport(t transport.Transport) Option

WithTransport sets the client transport to be used to communicate with server.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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