Documentation
¶
Overview ¶
Package simple_chat_api exposes Simple Chat over the network: the CRUD RPCs of artel_api.SimpleChatAPI here, and the live turn WebSocket in chat_ws.go. The two halves live in one package so the wire contract for a chat thread stays in one place.
Index ¶
- Constants
- type ChatWsHandler
- type SimpleChatImpl
- func (s *SimpleChatImpl) CreateSimpleChat(ctx context.Context, req *artel_api.CreateSimpleChat_Request) (*artel_api.CreateSimpleChat_Response, error)
- func (s *SimpleChatImpl) DeleteSimpleChat(ctx context.Context, req *artel_api.DeleteSimpleChat_Request) (*artel_api.DeleteSimpleChat_Response, error)
- func (s *SimpleChatImpl) Gateway(ctx context.Context, endpoint string, opts ...grpc.DialOption) (string, http.Handler)
- func (s *SimpleChatImpl) GetSimpleChat(ctx context.Context, req *artel_api.GetSimpleChat_Request) (*artel_api.GetSimpleChat_Response, error)
- func (s *SimpleChatImpl) ListSimpleChats(ctx context.Context, req *artel_api.ListSimpleChats_Request) (*artel_api.ListSimpleChats_Response, error)
- func (s *SimpleChatImpl) Register(srv grpc.ServiceRegistrar)
Constants ¶
const ( // ChatWsRoutePattern is the http.ServeMux pattern this handler is registered under in // internal/app/custom.go. // // It sits under "/api/" on purpose: the session cookie this handler authenticates with is // scoped to middleware.CookiePath ("/api/"), so a route outside that prefix would never // receive it. Being more specific than the grpc-gateway's "/api/simple-chats/" subtree // pattern, http.ServeMux routes a matching request here rather than to the gateway. ChatWsRoutePattern = "/api/simple-chats/{chatId}/ws" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatWsHandler ¶
type ChatWsHandler struct {
// contains filtered or unexported fields
}
ChatWsHandler serves the live Simple Chat turn exchange. It speaks the same chatprotocol.Event envelope as the Docker workbench's in-container bridge, so the web client reuses its existing chat components unchanged — but the agent runs in this process rather than in a container.
Unlike the workbench bridge there is no in-memory backlog or JSONL replay: a reconnecting client rebuilds history from Postgres via the GetSimpleChat RPC, so this handler only ever streams events for turns it is currently running.
func NewChatWsHandler ¶
func NewChatWsHandler(authSvc chatAuthService, simpleChatSvc service.SimpleChatService) *ChatWsHandler
func (*ChatWsHandler) ServeHTTP ¶
func (h *ChatWsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type SimpleChatImpl ¶
type SimpleChatImpl struct {
artel_api.UnimplementedSimpleChatAPIServer
// contains filtered or unexported fields
}
func New ¶
func New(simpleChatSvc service.SimpleChatService) *SimpleChatImpl
func (*SimpleChatImpl) CreateSimpleChat ¶
func (s *SimpleChatImpl) CreateSimpleChat( ctx context.Context, req *artel_api.CreateSimpleChat_Request, ) (*artel_api.CreateSimpleChat_Response, error)
func (*SimpleChatImpl) DeleteSimpleChat ¶
func (s *SimpleChatImpl) DeleteSimpleChat( ctx context.Context, req *artel_api.DeleteSimpleChat_Request, ) (*artel_api.DeleteSimpleChat_Response, error)
func (*SimpleChatImpl) Gateway ¶
func (s *SimpleChatImpl) Gateway( ctx context.Context, endpoint string, opts ...grpc.DialOption, ) (string, http.Handler)
func (*SimpleChatImpl) GetSimpleChat ¶
func (s *SimpleChatImpl) GetSimpleChat( ctx context.Context, req *artel_api.GetSimpleChat_Request, ) (*artel_api.GetSimpleChat_Response, error)
func (*SimpleChatImpl) ListSimpleChats ¶
func (s *SimpleChatImpl) ListSimpleChats( ctx context.Context, req *artel_api.ListSimpleChats_Request, ) (*artel_api.ListSimpleChats_Response, error)
func (*SimpleChatImpl) Register ¶
func (s *SimpleChatImpl) Register(srv grpc.ServiceRegistrar)