mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-27 15:24:43 +02:00
New Crowdin updates (#7046)
* New translations ja-JP.yml (German) * New translations ja-JP.yml (English) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Simplified) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations aiscript.md (German) * New translations theme.md (German) * New translations reaction.md (German) * New translations theme.md (German) * New translations theme.md (German) * New translations ja-JP.yml (German) * New translations theme.md (German) * New translations timelines.md (German) * New translations ja-JP.yml (German) * New translations mute.md (German) * New translations timelines.md (German) * New translations mute.md (German) * New translations reaction.md (German) * New translations pages.md (German) * New translations reaction.md (German) * New translations follow.md (German) * New translations pages.md (German) * New translations custom-emoji.md (German) * New translations follow.md (German) * New translations custom-emoji.md (English) * New translations deck.md (German) * New translations mfm.md (German) * New translations create-plugin.md (German) * New translations deck.md (German) * New translations create-plugin.md (German) * New translations create-plugin.md (English) * New translations create-plugin.md (German) * New translations keyboard-shortcut.md (German) * New translations keyboard-shortcut.md (German) * New translations create-plugin.md (German) * New translations keyboard-shortcut.md (German) * New translations create-plugin.md (German) * New translations create-plugin.md (German) * New translations reversi-bot.md (German) * New translations create-plugin.md (English) * New translations reversi-bot.md (English) * New translations create-plugin.md (German) * New translations reversi-bot.md (German) * New translations reversi-bot.md (German) * New translations stream.md (German) * New translations reversi-bot.md (English) * New translations reversi-bot.md (German) * New translations reversi-bot.md (German) * New translations reversi-bot.md (German) * New translations reversi-bot.md (English) * New translations reversi-bot.md (German) * New translations reversi-bot.md (English) * New translations reversi-bot.md (German) * New translations reversi-bot.md (German) * New translations reversi-bot.md (German) * New translations pages.md (Chinese Simplified) * New translations pages.md (Chinese Simplified) * New translations pages.md (Chinese Simplified) * New translations pages.md (Chinese Simplified) * New translations reaction.md (Chinese Simplified) * New translations reaction.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations ja-JP.yml (German) * New translations api.md (German) * New translations keyboard-shortcut.md (German) * New translations api.md (German) * New translations stream.md (German) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations ja-JP.yml (German) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations stream.md (German) * New translations ja-JP.yml (German) * New translations reversi-bot.md (German) * New translations stream.md (German) * New translations stream.md (German) * New translations stream.md (German) * New translations ja-JP.yml (Chinese Traditional) * New translations stream.md (German) * New translations ja-JP.yml (Chinese Traditional) * New translations stream.md (German) * New translations ja-JP.yml (Chinese Traditional) * New translations stream.md (German) * New translations ja-JP.yml (Chinese Traditional) * New translations stream.md (English) * New translations stream.md (German) * New translations ja-JP.yml (Chinese Traditional) * New translations stream.md (German) * New translations stream.md (German) * New translations stream.md (German) * New translations stream.md (English) * New translations stream.md (German) * New translations api.md (German) * New translations api.md (English) * New translations api.md (German) * New translations api.md (German) * New translations api.md (English) * New translations api.md (German) * New translations api.md (German) * New translations api.md (German) * New translations ja-JP.yml (Chinese Traditional) * New translations create-plugin.md (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations reversi-bot.md (Chinese Simplified) * New translations reversi-bot.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations stream.md (Chinese Simplified) * New translations ja-JP.yml (Kabyle) * New translations ja-JP.yml (Korean) * New translations ja-JP.yml (Spanish) * New translations ja-JP.yml (Russian) * New translations ja-JP.yml (German) * New translations ja-JP.yml (English) * New translations ja-JP.yml (Chinese Simplified) * New translations ja-JP.yml (Polish) * New translations custom-emoji.md (Polish) * New translations mute.md (Polish) * New translations ja-JP.yml (Polish) * New translations ja-JP.yml (Polish) * New translations follow.md (Polish) * New translations ja-JP.yml (Polish) * New translations create-plugin.md (Polish) * New translations reaction.md (Polish) * New translations theme.md (Polish) * New translations timelines.md (Polish) * New translations ja-JP.yml (English) * New translations ja-JP.yml (Polish) * New translations ja-JP.yml (Polish) * New translations ja-JP.yml (Polish) * New translations aiscript.md (Polish) * New translations keyboard-shortcut.md (Polish) * New translations pages.md (Polish) * New translations reversi-bot.md (Polish) * New translations stream.md (Polish) * New translations theme.md (Polish) * New translations ja-JP.yml (Polish) * New translations timelines.md (Polish) * New translations deck.md (Polish) * New translations ja-JP.yml (Indonesian) * New translations aiscript.md (Indonesian) * New translations api.md (Indonesian) * New translations create-plugin.md (Indonesian) * New translations custom-emoji.md (Indonesian) * New translations follow.md (Indonesian) * New translations keyboard-shortcut.md (Indonesian) * New translations mute.md (Indonesian) * New translations pages.md (Indonesian) * New translations reaction.md (Indonesian) * New translations reversi-bot.md (Indonesian) * New translations stream.md (Indonesian) * New translations theme.md (Indonesian) * New translations timelines.md (Indonesian) * New translations deck.md (Indonesian) * New translations mfm.md (Indonesian) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Chinese Traditional) * New translations ja-JP.yml (Indonesian) * New translations keyboard-shortcut.md (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations reaction.md (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations mute.md (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations custom-emoji.md (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations ja-JP.yml (Indonesian) * New translations ja-JP.yml (Indonesian)
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
# 流式API
|
||||
|
||||
ストリーミングAPIを使うと、リアルタイムで様々な情報(例えばタイムラインに新しい投稿が流れてきた、メッセージが届いた、フォローされた、など)を受け取ったり、様々な操作を行ったりすることができます。
|
||||
通过流式API,您可以实时接收各种信息(例如,你的时间线中的新帖文,收到的消息,关注等),并进行各种操作。
|
||||
|
||||
## ストリームに接続する
|
||||
## 连接到流
|
||||
|
||||
ストリーミングAPIを利用するには、まずMisskeyサーバーに**websocket**接続する必要があります。
|
||||
要使用流式API,您需要使用**websocket**连接到Misskey服务器。
|
||||
|
||||
以下のURLに、`i`というパラメータ名で認証情報を含めて、websocket接続してください。例:
|
||||
请使用参数`i`连接到以下URL,并在websocket连接中包含认证信息。例如:
|
||||
```
|
||||
%WS_URL%/streaming?i=xxxxxxxxxxxxxxx
|
||||
```
|
||||
|
||||
認証情報は、自分のAPIキーや、アプリケーションからストリームに接続する際はユーザーのアクセストークンのことを指します。
|
||||
认证信息是您的API密钥,从应用程序连接到流时需要引用的用户访问令牌
|
||||
|
||||
<div class="ui info">
|
||||
<p><i class="fas fa-info-circle"></i> 認証情報の取得については、<a href="./api">こちらのドキュメント</a>をご確認ください。</p>
|
||||
<p><i class="fas fa-info-circle"></i> 关于如何获取认证信息,请参考<a href="./api">此文档</a>。</p>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
認証情報は省略することもできますが、その場合非ログインでの利用ということになり、受信できる情報や可能な操作は限られます。例:
|
||||
您可以省略身份验证信息。此时无需登录即可使用,但是可以接收的信息和可以执行的操作将受到限制。例:
|
||||
|
||||
```
|
||||
%WS_URL%/streaming
|
||||
@@ -27,15 +27,15 @@
|
||||
|
||||
---
|
||||
|
||||
ストリームに接続すると、後述するAPI操作や、投稿の購読を行ったりすることができます。 しかしまだこの段階では、例えばタイムラインへの新しい投稿を受信したりすることはできません。 それを行うには、ストリーム上で、後述する**チャンネル**に接続する必要があります。
|
||||
通过连接到流,您可以执行后文所示的API操作并订阅帖子。 但是此时例如时间线上的新帖子等还无法接收到。 要实现此功能,您需要连接到后文所述的流的**频道**。
|
||||
|
||||
**ストリームでのやり取りはすべてJSONです。**
|
||||
**所有流交互都是JSON格式。**
|
||||
|
||||
## 频道
|
||||
MisskeyのストリーミングAPIにはチャンネルという概念があります。これは、送受信する情報を分離するための仕組みです。 Misskeyのストリームに接続しただけでは、まだリアルタイムでタイムラインの投稿を受信したりはできません。 ストリーム上でチャンネルに接続することで、様々な情報を受け取ったり情報を送信したりすることができるようになります。
|
||||
频道是Misskey的流API中的概念。这是一种分离发送和接收信息的机制。 您无法仅通过连接到Misskey流来实时接收时间线帖子。 需要通过连接到流中的频道,您才能够接收和发送各种消息。
|
||||
|
||||
### チャンネルに接続する
|
||||
チャンネルに接続するには、次のようなデータをJSONでストリームに送信します:
|
||||
### 连接到频道
|
||||
要连接到频道,请将JSON数据发送到流:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -50,19 +50,19 @@ MisskeyのストリーミングAPIにはチャンネルという概念があり
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
* `channel`には接続したいチャンネル名を設定します。チャンネルの種類については後述します。
|
||||
* `id`にはそのチャンネルとやり取りするための任意のIDを設定します。ストリームでは様々なメッセージが流れるので、そのメッセージがどのチャンネルからのものなのか識別する必要があるからです。このIDは、UUIDや、乱数のようなもので構いません。
|
||||
* `params`はチャンネルに接続する際のパラメータです。チャンネルによって接続時に必要とされるパラメータは異なります。パラメータ不要のチャンネルに接続する際は、このプロパティは省略可能です。
|
||||
其中:
|
||||
* `channel`中可以设置您要连接的频道名。频道类型将在后面说明。
|
||||
* `id`设置用于与频道通信的ID。因为流中有着各种消息,因此需要确定消息来自哪个频道。该ID可以是UUID或随机数。
|
||||
* `params`是连接到频道时传的参数。连接不同的频道时需要不同的参数。连接到无需参数的频道时,该属性为可选。
|
||||
|
||||
<div class="ui info">
|
||||
<p><i class="fas fa-info-circle"></i> IDはチャンネルごとではなく「チャンネルの接続ごと」です。なぜなら、同じチャンネルに異なるパラメータで複数接続するケースもあるからです。</p>
|
||||
<p><i class="fas fa-info-circle"></i> ID对应的是“频道的连接”,而不是频道。因为在某些情况下会使用不同的参数对同一频道进行多个连接。</p>
|
||||
</div>
|
||||
|
||||
### チャンネルからのメッセージを受け取る
|
||||
例えばタイムラインのチャンネルなら、新しい投稿があった時にメッセージを発します。そのメッセージを受け取ることで、タイムラインに新しい投稿がされたことをリアルタイムで知ることができます。
|
||||
### 从频道接收消息
|
||||
例如,当有新帖子时,时间线的频道将发送一条消息。通过接收此消息,您可以实时知道时间线上有新帖子。
|
||||
|
||||
チャンネルがメッセージを発すると、次のようなデータがJSONでストリームに流れてきます:
|
||||
当频道发出消息时,以下数据将以JSON格式传输到流中:
|
||||
```json
|
||||
{
|
||||
type: 'channel',
|
||||
@@ -76,15 +76,15 @@ MisskeyのストリーミングAPIにはチャンネルという概念があり
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
* `id`には前述したそのチャンネルに接続する際に設定したIDが設定されています。これで、このメッセージがどのチャンネルからのものなのか知ることができます。
|
||||
* `type`にはメッセージの種類が設定されます。チャンネルによって、どのような種類のメッセージが流れてくるかは異なります。
|
||||
* `body`にはメッセージの内容が設定されます。チャンネルによって、どのような内容のメッセージが流れてくるかは異なります。
|
||||
其中:
|
||||
* `id`为前文所述连接到频道时所设置的ID。因此可以知道此消息来自哪个频道。
|
||||
* `type`为所设的消息类型。不同的频道会有不同类型的消息。
|
||||
* `body`为所设的消息内容。不同的频道中的消息内容也会有不同。
|
||||
|
||||
### チャンネルに向けてメッセージを送信する
|
||||
チャンネルによっては、メッセージを受け取るだけでなく、こちらから何かメッセージを送信し、何らかの操作を行える場合があります。
|
||||
### 向频道发送消息
|
||||
根据频道的不同,您不仅可以接收消息,而且还可以发送消息并执行某些操作。
|
||||
|
||||
チャンネルにメッセージを送信するには、次のようなデータをJSONでストリームに送信します:
|
||||
要将消息发送到频道,请将JSON格式数据发送到流:
|
||||
```json
|
||||
{
|
||||
type: 'channel',
|
||||
@@ -98,13 +98,13 @@ MisskeyのストリーミングAPIにはチャンネルという概念があり
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
* `id`には前述したそのチャンネルに接続する際に設定したIDを設定します。これで、このメッセージがどのチャンネルに向けたものなのか識別させることができます。
|
||||
* `type`にはメッセージの種類を設定します。チャンネルによって、どのような種類のメッセージを受け付けるかは異なります。
|
||||
* `body`にはメッセージの内容を設定します。チャンネルによって、どのような内容のメッセージを受け付けるかは異なります。
|
||||
其中:
|
||||
* `id`为前文所述连接到频道时想要设置的ID。因此您可以决定此消息发送到哪个频道。
|
||||
* `type`为想要设置的消息类型。不同的频道会接受不同类型的消息。
|
||||
* `body`为想要设置的消息内容。不同的频道接受的消息内容也会不同。
|
||||
|
||||
### チャンネルから切断する
|
||||
チャンネルから切断するには、次のようなデータをJSONでストリームに送信します:
|
||||
### 断开频道连接
|
||||
要断开与频道的连接,请将JSON格式数据发送到流:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -115,8 +115,8 @@ MisskeyのストリーミングAPIにはチャンネルという概念があり
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
* `id`には前述したそのチャンネルに接続する際に設定したIDを設定します。
|
||||
其中:
|
||||
* `id`为前文所述连接到频道时想要设置的ID。
|
||||
|
||||
## ストリームを経由してAPIリクエストする
|
||||
|
||||
@@ -136,7 +136,7 @@ MisskeyのストリーミングAPIにはチャンネルという概念があり
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
其中:
|
||||
* `id`には、APIのレスポンスを識別するための、APIリクエストごとの一意なIDを設定する必要があります。UUIDや、簡単な乱数のようなもので構いません。
|
||||
* `endpoint`には、あなたがリクエストしたいAPIのエンドポイントを指定します。
|
||||
* `data`には、エンドポイントのパラメータを含めます。
|
||||
@@ -158,7 +158,7 @@ APIへリクエストすると、レスポンスがストリームから次の
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
其中:
|
||||
* `xxxxxxxxxxxxxxxx`の部分には、リクエストの際に設定された`id`が含まれています。これにより、どのリクエストに対するレスポンスなのか判別することができます。
|
||||
* `body`には、レスポンスが含まれています。
|
||||
|
||||
@@ -185,7 +185,7 @@ Misskeyは投稿のキャプチャと呼ばれる仕組みを提供していま
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
其中:
|
||||
* `id`にキャプチャしたい投稿の`id`を設定します。
|
||||
|
||||
このメッセージを送信すると、Misskeyにキャプチャを要請したことになり、以後、その投稿に関するイベントが流れてくるようになります。
|
||||
@@ -206,7 +206,7 @@ Misskeyは投稿のキャプチャと呼ばれる仕組みを提供していま
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
其中:
|
||||
* `body`内の`id`に、イベントを発生させた投稿のIDが設定されます。
|
||||
* `body`内の`type`に、イベントの種類が設定されます。
|
||||
* `body`内の`body`に、イベントの詳細が設定されます。
|
||||
@@ -219,7 +219,7 @@ Misskeyは投稿のキャプチャと呼ばれる仕組みを提供していま
|
||||
* `reaction`に、リアクションの種類が設定されます。
|
||||
* `userId`に、リアクションを行ったユーザーのIDが設定されます。
|
||||
|
||||
例:
|
||||
例:
|
||||
```json
|
||||
{
|
||||
type: 'noteUpdated',
|
||||
@@ -239,7 +239,7 @@ Misskeyは投稿のキャプチャと呼ばれる仕組みを提供していま
|
||||
|
||||
* `deletedAt`に、削除日時が設定されます。
|
||||
|
||||
例:
|
||||
例:
|
||||
```json
|
||||
{
|
||||
type: 'noteUpdated',
|
||||
@@ -259,7 +259,7 @@ Misskeyは投稿のキャプチャと呼ばれる仕組みを提供していま
|
||||
* `choice`に、選択肢IDが設定されます。
|
||||
* `userId`に、投票を行ったユーザーのIDが設定されます。
|
||||
|
||||
例:
|
||||
例:
|
||||
```json
|
||||
{
|
||||
type: 'noteUpdated',
|
||||
@@ -289,7 +289,7 @@ Misskeyは投稿のキャプチャと呼ばれる仕組みを提供していま
|
||||
}
|
||||
```
|
||||
|
||||
ここで、
|
||||
其中:
|
||||
* `id`にキャプチャを解除したい投稿の`id`を設定します。
|
||||
|
||||
このメッセージを送信すると、以後、その投稿に関するイベントは流れてこないようになります。
|
||||
|
||||
Reference in New Issue
Block a user