Documentation ¶
Index ¶
- Variables
- type BaseWebsocketMessage
- type Client
- func (client *Client) CloseWebsocket() error
- func (client *Client) DownloadImage(info *websocket_message_model.Image) (string, []byte, error)
- func (client *Client) Extensions() ([]string, error)
- func (client *Client) GetUsers() (*model.UserList, error)
- func (client *Client) Prompt(requestBody *model.PromptRequest) (*model.PromptResponse, error)
- func (client *Client) RegisterMessageProcessor(messageType string, function func(message *BaseWebsocketMessage) error)
- func (client *Client) SelectUser(userID string)
- func (client *Client) UploadImage(filename string, body []byte) (*model.UpLoadImage, error)
- func (client *Client) UploadImageFile(filename string) (*model.UpLoadImage, error)
- func (client *Client) Workflow(path string) (*model.WorkflowDetail, error)
- func (client *Client) WorkflowList() ([]*model.Workflow, error)
- type ClientOption
- type Input
- type InputType
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorsServerError = errors.New("server error") ErrorMessageTypeProcessorIsExists = errors.New("this message type processor is Exists") )
View Source
var (
ErrorContentTypeIsUnknown = errors.New("content type is unknown")
)
Functions ¶
This section is empty.
Types ¶
type BaseWebsocketMessage ¶
type BaseWebsocketMessage struct { Type string `json:"type"` Data json.RawMessage `json:"data"` }
type Client ¶
type Client struct { WebSocketConnection *websocket.Conn Wg *sync.WaitGroup ClientID string UserID string // contains filtered or unexported fields }
func NewClient ¶
func NewClient(opt *ClientOption) (*Client, error)
Example ¶
ExampleNewClient is a sample function to show how to use NewClient
opt := &ClientOption{ Host: "127.0.0.1", Port: 8818, Wg: &sync.WaitGroup{}, ClientID: uuid.New().String(), } c, err := NewClient(opt) if err != nil { fmt.Println(err) return } fmt.Println(c.ClientID)
Output: 61d52256-add9-4573-8b31-d27c92f6d8bb
func (*Client) CloseWebsocket ¶
func (*Client) DownloadImage ¶
func (*Client) Extensions ¶
func (*Client) Prompt ¶
func (client *Client) Prompt(requestBody *model.PromptRequest) (*model.PromptResponse, error)
func (*Client) RegisterMessageProcessor ¶
func (client *Client) RegisterMessageProcessor(messageType string, function func(message *BaseWebsocketMessage) error)
func (*Client) SelectUser ¶
func (*Client) UploadImage ¶
func (*Client) UploadImageFile ¶
func (client *Client) UploadImageFile(filename string) (*model.UpLoadImage, error)
type ClientOption ¶
Click to show internal directories.
Click to hide internal directories.