Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWSInInitContext = common.NewInitContextError("using websockets in the init context is not supported")

    ErrWSInInitContext is returned when websockets are using in the init context

    Functions

    This section is empty.

    Types

    type Socket

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

    func (*Socket) Close

    func (s *Socket) Close(args ...goja.Value)

    func (*Socket) On

    func (s *Socket) On(event string, handler goja.Value)

    func (*Socket) Ping

    func (s *Socket) Ping()

    func (*Socket) Send

    func (s *Socket) Send(message string)

    func (*Socket) SetInterval

    func (s *Socket) SetInterval(fn goja.Callable, intervalMs float64) error

      SetInterval executes the provided function inside the socket's event loop each interval time, which is in ms

      func (*Socket) SetTimeout

      func (s *Socket) SetTimeout(fn goja.Callable, timeoutMs float64) error

        SetTimeout executes the provided function inside the socket's event loop after at least the provided timeout, which is in ms, has elapsed

        type WS

        type WS struct{}

        func New

        func New() *WS

        func (*WS) Connect

        func (*WS) Connect(ctx context.Context, url string, args ...goja.Value) (*WSHTTPResponse, error)

        type WSHTTPResponse

        type WSHTTPResponse struct {
        	URL     string            `json:"url"`
        	Status  int               `json:"status"`
        	Headers map[string]string `json:"headers"`
        	Body    string            `json:"body"`
        	Error   string            `json:"error"`
        }

        Source Files