Versions in this module Expand all Collapse all v0 v0.10.8 Aug 30, 2021 v0.10.7 Aug 30, 2021 v0.10.6 Aug 30, 2021 v0.10.5 Aug 30, 2021 v0.10.4 Aug 30, 2021 Changes in this version + const EventAck + const EventConnect + const EventError + const EventParams + const EventPatch + const EventRedirect + const LiveRendered + var ErrMessageMalformed = errors.New("message malformed") + var ErrNoEventHandler = errors.New("view missing event handler") + var ErrNoRenderer = errors.New("no renderer has been set on the handler") + var ErrNoSocket = errors.New("no socket") + func NewID() string + type CookieStore struct + Store *sessions.CookieStore + func NewCookieStore(sessionName string, keyPairs ...[]byte) *CookieStore + func (c CookieStore) Get(r *http.Request) (Session, error) + func (c CookieStore) Save(w http.ResponseWriter, r *http.Request, session Session) error + type ErrorHandler func(ctx context.Context, w http.ResponseWriter, r *http.Request, err error) + type Event struct + Data json.RawMessage + ID int + T string + func (e Event) Params() (Params, error) + type EventConfig func(e *Event) error + func WithID(ID int) EventConfig + type EventHandler func(context.Context, *Socket, Params) (interface{}, error) + type Handler struct + Error ErrorHandler + Mount MountHandler + Render RenderHandler + func NewHandler(store SessionStore, configs ...HandlerConfig) (*Handler, error) + func (h *Handler) Broadcast(event string, data interface{}) error + func (h *Handler) HandleEvent(t string, handler EventHandler) + func (h *Handler) HandleParams(handler EventHandler) + func (h *Handler) HandleSelf(t string, handler EventHandler) + func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) + type HandlerConfig func(h *Handler) error + func WithTemplateRenderer(t *template.Template) HandlerConfig + type Javascript struct + func (j Javascript) ServeHTTP(w http.ResponseWriter, r *http.Request) + type JavascriptMap struct + func (j JavascriptMap) ServeHTTP(w http.ResponseWriter, r *http.Request) + type LocalTransport struct + func NewLocalTransport() *LocalTransport + func (l *LocalTransport) Listen(ctx context.Context, p *PubSub) error + func (l *LocalTransport) Publish(ctx context.Context, topic string, msg Event) error + type MountHandler func(ctx context.Context, r *http.Request, c *Socket) (interface{}, error) + type Params map[string]interface + func (p Params) Checkbox(key string) bool + func (p Params) Float32(key string) float32 + func (p Params) Int(key string) int + func (p Params) String(key string) string + func NewParamsFromRequest(r *http.Request) Params + type Patch struct + Action PatchAction + HTML string + Path []int + func Diff(current, proposed *html.Node) ([]Patch, error) + func (p Patch) String() string + type PatchAction uint32 + const Append + const Insert + const Noop + const Prepend + const Replace + type PubSub struct + func NewPubSub(ctx context.Context, t PubSubTransport) *PubSub + func (p *PubSub) Publish(ctx context.Context, topic string, msg Event) error + func (p *PubSub) Recieve(topic string, msg Event) + func (p *PubSub) Subscribe(topic string, h *Handler) + type PubSubTransport interface + Listen func(ctx context.Context, p *PubSub) error + Publish func(ctx context.Context, topic string, msg Event) error + type RenderHandler func(ctx context.Context, data interface{}) (io.Reader, error) + type Session struct + ID string + func NewSession() Session + type SessionStore interface + Get func(*http.Request) (Session, error) + Save func(http.ResponseWriter, *http.Request, Session) error + type Socket struct + Session Session + func NewSocket(s Session, h *Handler, connected bool) *Socket + func (s *Socket) Assign(data interface{}) + func (s *Socket) Assigns() interface{} + func (s *Socket) Broadcast(event string, data interface{}) error + func (s *Socket) Connected() bool + func (s *Socket) PatchURL(values url.Values) + func (s *Socket) Redirect(u *url.URL) + func (s *Socket) Self(ctx context.Context, event string, data interface{}) error + func (s *Socket) Send(event string, data interface{}, options ...EventConfig) error + type TransportMessage struct + Msg Event + Topic string + type ValueKey string