sockettest

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sockettest is a fake Slack Socket Mode server for tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server accepts one Socket Mode connection at a time. Frames sent while no client is connected wait for the next connection.

func New

func New(t testing.TB) *Server

func (*Server) Acks

func (s *Server) Acks() []string

Acks are the envelope ids the client acknowledged, in order.

func (*Server) Disconnect

func (s *Server) Disconnect(reason string)

Disconnect sends a disconnect envelope; later frames go to the next connection.

func (*Server) Drop

func (s *Server) Drop()

Drop closes the current connection without a close handshake.

func (*Server) Hello

func (s *Server) Hello(n int)

func (*Server) Open

func (s *Server) Open(ctx context.Context) (string, error)

Open plays apps.connections.open: it counts the call and returns a fresh URL with a ticket and an app id in the query, as Slack does.

func (*Server) Opens

func (s *Server) Opens() int

func (*Server) Send

func (s *Server) Send(frame any)

Send writes frame (JSON-encoded unless it is a string or []byte) to the current connection, waiting up to 5 s for one.

func (*Server) URL

func (s *Server) URL() string

URL is the WebSocket endpoint without a ticket.

Jump to

Keyboard shortcuts

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