streaming

package
v0.0.0-...-9914b64 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package streaming provides the WebSocket /streaming endpoint that Misskey clients connect to for live timeline / notification updates.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionAcceptor

type ConnectionAcceptor interface {
	Accept(conn *websocket.Conn, user *model.User, scopes []string, credential string)
}

ConnectionAcceptor receives an upgraded WebSocket connection, an optional authenticated user, and the OAuth2 scopes the connection is limited to. パッケージ間の循環依存を避けるため interface で受け取る (実装は internal/stream の Manager)。

scopes は **app access_token のときだけ non-nil**。nil は「スコープによる 制限が無い」を意味し、native login token (フロントエンドが使う) と 匿名接続がそちらに当たる。mk-go は cookie 認証を持たない。空の non-nil slice は「スコープを 1 つも持たない app token」で、 nil とは区別する。

credential は認証に使った資格情報の鍵 (internal/misc/credkey)。匿名は ""。 トークンが失効したときに、そのトークンで張られた接続だけを閉じるのに使う。

type Handler

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

Handler upgrades incoming HTTP requests to a WebSocket and hands the resulting connection to a ConnectionAcceptor. 認証はミドルウェア (RequireAuth ではなく Authenticate のみ) でベストエフォートに行い、未認証接続も許容する。

func NewHandler

func NewHandler(acceptor ConnectionAcceptor) *Handler

NewHandler constructs a Handler. acceptor が nil の場合、upgrade 直後に 接続を閉じる (テスト用)。

func (*Handler) Stream

func (h *Handler) Stream(c *echo.Context) error

Stream handles GET /streaming. WebSocket への upgrade に成功したら接続を acceptor に渡し、失敗したら 400 / 426 のまま終了する (gorilla/websocket が 自動で適切な status を返す)。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL