good morning!!!!

Skip to content
Snippets Groups Projects
client.go 1.25 KiB
Newer Older
a's avatar
wip
a committed
package websocket

import (
	"context"
a's avatar
a committed
	jrpc2 "gfx.cafe/open/jrpc/pkg/codec"
a's avatar
wip
a committed
	"sync"

	"gfx.cafe/open/jrpc"
	"nhooyr.io/websocket"
)

type Client struct {
	conn          *websocket.Conn
	reconnectFunc reconnectFunc

	mu sync.RWMutex
}

type reconnectFunc func(ctx context.Context) (*websocket.Conn, error)

func newClient(initctx context.Context, connect reconnectFunc) (*Client, error) {
	conn, err := connect(initctx)
	if err != nil {
		return nil, err
	}
	c := &Client{}
	c.conn = conn
	c.reconnectFunc = connect
	return c, nil
}

func (c *Client) Do(ctx context.Context, result any, method string, params any) error {
	panic("not implemented") // TODO: Implement
}

a's avatar
a committed
func (c *Client) BatchCall(ctx context.Context, b ...jrpc2.BatchElem) error {
a's avatar
wip
a committed
	panic("not implemented") // TODO: Implement
}

func (c *Client) SetHeader(key string, value string) {
	panic("not implemented") // TODO: Implement
}

func (c *Client) Close() error {
	panic("not implemented") // TODO: Implement
}

func (c *Client) Notify(ctx context.Context, method string, args ...any) error {
	panic("not implemented") // TODO: Implement
}

func (c *Client) Subscribe(ctx context.Context, namespace string, channel any, args ...any) (*jrpc.ClientSubscription, error) {
	panic("not implemented") // TODO: Implement
}