gobench

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package gobench implements alternative controller for benchmarking Go server w/o RPC. Mimics BenchmarkChannel from https://github.com/palkan/websocket-shootout/blob/master/ruby/action-cable-server/app/channels/benchmark_channel.rb

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastMessage

type BroadcastMessage struct {
	Stream string `json:"stream"`
	Data   string `json:"data"`
}

BroadcastMessage represents a pubsub payload

type Controller

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

Controller implements node.Controller interface for gRPC

func NewController

func NewController(metrics *metrics.Metrics, logger *slog.Logger) *Controller

NewController builds new Controller from config

func (*Controller) Authenticate

func (c *Controller) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)

Authenticate allows everyone to connect and returns welcome message and rendom ID as identifier

func (*Controller) Disconnect

func (c *Controller) Disconnect(sid string, env *common.SessionEnv, id string, subscriptions []string) error

Disconnect performs disconnect RPC call

func (*Controller) Perform

func (c *Controller) Perform(sid string, env *common.SessionEnv, id string, channel string, data string) (res *common.CommandResult, err error)

Perform performs Command RPC call with "perform" command

func (*Controller) Shutdown

func (c *Controller) Shutdown() error

Shutdown is no-op

func (*Controller) Start

func (c *Controller) Start() error

Start is no-op

func (*Controller) Subscribe

func (c *Controller) Subscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)

Subscribe performs Command RPC call with "subscribe" command

func (*Controller) Unsubscribe

func (c *Controller) Unsubscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)

Unsubscribe performs Command RPC call with "unsubscribe" command

type Identifiers

type Identifiers struct {
	ID string `json:"id"`
}

Identifiers represents a connection identifiers

Jump to

Keyboard shortcuts

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