From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/api/pushsubscription/endpoint/index.html | 125 +++++++++++++++++ .../ja/web/api/pushsubscription/getkey/index.html | 156 +++++++++++++++++++++ files/ja/web/api/pushsubscription/index.html | 90 ++++++++++++ .../ja/web/api/pushsubscription/tojson/index.html | 123 ++++++++++++++++ .../api/pushsubscription/unsubscribe/index.html | 127 +++++++++++++++++ 5 files changed, 621 insertions(+) create mode 100644 files/ja/web/api/pushsubscription/endpoint/index.html create mode 100644 files/ja/web/api/pushsubscription/getkey/index.html create mode 100644 files/ja/web/api/pushsubscription/index.html create mode 100644 files/ja/web/api/pushsubscription/tojson/index.html create mode 100644 files/ja/web/api/pushsubscription/unsubscribe/index.html (limited to 'files/ja/web/api/pushsubscription') diff --git a/files/ja/web/api/pushsubscription/endpoint/index.html b/files/ja/web/api/pushsubscription/endpoint/index.html new file mode 100644 index 0000000000..319170d8c6 --- /dev/null +++ b/files/ja/web/api/pushsubscription/endpoint/index.html @@ -0,0 +1,125 @@ +--- +title: PushSubscription.endpoint +slug: Web/API/PushSubscription/endpoint +tags: + - API + - Experimental + - Property + - Push + - Push API + - PushSubscription + - Reference + - Service Workers + - endPoint +translation_of: Web/API/PushSubscription/endpoint +--- +

{{SeeCompatTable}}{{APIRef("Push API")}}

+ +

{{domxref("PushSubscription")}} インターフェースの endpoint 読み取り専用プロパティは、プッシュサブスクリプションに関連するエンドポイントを含む {{domxref("USVString")}} を返します。

+ +

エンドポイントは、 プッシュサービスに加入している特定の Service Worker にプッシュメッセージを送信するために使用するプッシュサーバーへのカスタム URL エンドポイントの形式をとります。このため、他者がこれをハイジャックしてプッシュ機能を乱用しないように、エンドポイントを秘匿する方が良いです。

+ +

構文

+ +
var myEnd = pushSubscription.endpoint;
+ +

+ +

{{domxref("USVString")}}。

+ +

+ +
navigator.serviceWorker.ready.then(function(reg) {
+  reg.pushManager.subscribe({userVisibleOnly: true}).then(function(subscription) {
+    console.log(subscription.endpoint);
+
+      // この時点で、サブスクリプションエンドポイントをサーバーに送信し、
+      // 保存した後、 後でプッシュメッセージを送信するために使用します。
+  })
+})
+
+ +

仕様

+ + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('Push API','#widl-PushSubscription-endpoint','endPoint')}}{{Spec2('Push API')}}初期定義。
+ +

ブラウザ実装状況

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
機能ChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
基本サポート{{CompatChrome(42.0)}}{{CompatGeckoDesktop(44.0)}}[1]{{CompatNo}}{{CompatUnknown}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
機能AndroidAndroid WebviewFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari MobileChrome for Android
基本サポート{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile(48)}}[2]{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatChrome(42.0)}}
+
+ + + +

関連項目

+ + diff --git a/files/ja/web/api/pushsubscription/getkey/index.html b/files/ja/web/api/pushsubscription/getkey/index.html new file mode 100644 index 0000000000..233bcc4446 --- /dev/null +++ b/files/ja/web/api/pushsubscription/getkey/index.html @@ -0,0 +1,156 @@ +--- +title: PushSubscription.getKey() +slug: Web/API/PushSubscription/getKey +tags: + - API + - Experimental + - Method + - Non-standard + - Push + - Push API + - PushSubscription + - Reference + - Service Workers + - getKey +translation_of: Web/API/PushSubscription/getKey +--- +

{{SeeCompatTable}}{{APIRef("Push API")}}

+ +

{{domxref("PushSubscription")}} インターフェースの getKey() メソッドは、サーバに送信されてプッシュメッセージデータを暗号化するために使用される、クライアントパブリックキーを表す {{domxref("ArrayBuffer")}} を返します。

+ +
+

ノート: 現在、Firefox のみの実装であり、まだ Push API 仕様には含まれていません。

+
+ +

構文

+ +
var key = subscription.getKey(method);
+ +

パラメーター

+ +
+
method
+
クライアントパブリックキーの生成に使用される暗号化メソッドです。現在、p256dhのみがオプションです。メソッドには次の値がが選べます: + +
+
+ +

戻り値

+ +

{{domxref("ArrayBuffer")}}。

+ +

+ +

Push API デモでは、プッシュメッセージデータの暗号化とサーバから特定のサブスクライバにプッシュメッセージを送信するために必要な認証を得るために、getKey('p256dh') と {{domxref("PushSubscription.endpoint")}} を呼び出しています。

+ +
reg.pushManager.getSubscription()
+  .then(function(subscription) {
+  // プッシュメッセージからサブスクライブ / アンサブスクライブ
+  // する任意の UI を有効にする
+
+  subBtn.disabled = false;
+
+  if (!subscription) {
+    console.log('Not yet subscribed to Push')
+    // プッシュを購読していない場合、ユーザーがプッシュできるように
+    // UI を設定する。
+    return;
+  }
+
+  // プッシュメッセージを購読していることを表示するように
+  // UI を設定する。
+  subBtn.textContent = 'Unsubscribe from Push Messaging';
+  isPushEnabled = true;
+
+  // 購読ステータスのための UI 要素の設定を含んで状態を初期化し、
+  // プッシュ経由でサブスクライバーを更新する。
+  var endpoint = subscription.endpoint;
+  var key = subscription.getKey('p256dh');
+
+    ...
+ +

仕様

+ + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('Push API')}}{{Spec2('Push API')}}これは Push API 仕様ですが、getKey() はここに含まれていないことに注意してください。現在は、Firefox だけの実験実装です。
+ +

ブラウザ実装状況

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
機能ChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
基本サポート{{CompatNo}}{{CompatGeckoDesktop(44.0)}}[1]{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
機能AndroidAndroid WebviewFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari MobileChrome for Android
基本サポート{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile(48)}}[2]{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}
+
+ + + +

関連項目

+ + diff --git a/files/ja/web/api/pushsubscription/index.html b/files/ja/web/api/pushsubscription/index.html new file mode 100644 index 0000000000..98b4e1412a --- /dev/null +++ b/files/ja/web/api/pushsubscription/index.html @@ -0,0 +1,90 @@ +--- +title: PushSubscription +slug: Web/API/PushSubscription +tags: + - API + - Experimental + - Interface + - Push + - Push API + - PushSubscription + - Reference + - Service Workers +translation_of: Web/API/PushSubscription +--- +
{{SeeCompatTable}}{{ApiRef("Push API")}}
+ +

Push APIPushSubscription インターフェースは、サブスクリプションの URL エンドポイントを提供するとともに、プッシュサービスの登録を解除できます。

+ +

このインターフェースのインスタンスはシリアライズできます。

+ +

プロパティ

+ +
+
{{domxref("PushSubscription.endpoint")}} {{readonlyinline}}
+
プッシュサービスに関連したエンドポイントを含む {{domxref("USVString")}}。
+
{{domxref("PushSubscription.expirationTime")}} {{readonlyinline}}
+
プッシュサブスクリプションに関連付いたサブスクリプション期限切れ時間を表す {{domxref("DOMHighResTimeStamp")}} 。存在しない場合は null。
+
{{domxref("PushSubscription.options")}} {{readonlyinline}}
+
サブスクリプションを作成するために用いられるオプションを含むオブジェクト。
+
+ +
+
{{domxref("PushSubscription.subscriptionId")}} {{deprecated_inline}} {{readonlyinline}}
+
プッシュサービスに関連したサブスクリプション ID を含む {{domxref("DOMString")}}。
+
+ +

メソッド

+ +
+
{{domxref("PushSubscription.getKey()")}}
+
サーバーに送信されてプッシュメッセージの暗号化に使用される、クライアントのパブリックキーを含む {{domxref("ArrayBuffer")}} を返します。
+
{{domxref("PushSubscription.toJSON()")}}
+
標準シリアライザー — サブスクリプションプロパティの JSON 記法を返します。
+
{{domxref("PushSubscription.unsubscribe()")}}
+
プッシュサービスの登録を解除する非同期プロセスを開始します。現在のサブスクリプションが成功裏に登録解除できた場合、{{domxref("Boolean")}} で解決される {{jsxref("Promise")}} を返します。
+
+ +

+ +
navigator.serviceWorker.ready.then(function(reg) {
+  reg.pushManager.getSubscription().then(function(subscription) {
+    subscription.unsubscribe().then(function(successful) {
+      // 成功裏に登録解除。
+    }).catch(function(e) {
+      // 登録解除失敗。
+    })
+  })
+});
+ +

仕様

+ + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName("Push API", "#pushsubscription-interface", "PushSubscription")}}{{Spec2("Push API")}}初期定義。
+ +

ブラウザー実装状況

+ +
+ + +

{{Compat("api.PushSubscription")}}

+
+ +

関連項目

+ + diff --git a/files/ja/web/api/pushsubscription/tojson/index.html b/files/ja/web/api/pushsubscription/tojson/index.html new file mode 100644 index 0000000000..27c47aa37f --- /dev/null +++ b/files/ja/web/api/pushsubscription/tojson/index.html @@ -0,0 +1,123 @@ +--- +title: PushSubscription.toJSON() +slug: Web/API/PushSubscription/toJSON +tags: + - API + - Experimental + - Method + - Push + - Push API + - PushSubscription + - Reference + - Service Workers + - toJSON +translation_of: Web/API/PushSubscription/toJSON +--- +

{{SeeCompatTable}}{{APIRef("Push API")}}

+ +

{{domxref("PushSubscription")}} インターフェースの toJSON() メソッドは、スタンダードなシリアライザーです:これは、便利なショートカットを提供するサブスクリプションプロパティの JSON 表記を返します。

+ +

構文

+ +
​mySubscription = subscription.toJSON()
+ +

パラメーター

+ +

なし。

+ +

戻り値

+ +

JSON オブジェクト。現在、endpoint メンバーとしてサブスクリプションエンドポイントのみを含みます。

+ +

+ +
navigator.serviceWorker.ready.then(function(reg) {
+  reg.pushManager.getSubscription().then(function(subscription) {
+    var mySubscription = subscription.toJSON();
+    // サブスクリプションの詳細を使用して何かを実行する。
+  })
+});
+ +

仕様

+ + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('Push API','#pushsubscription-interface','PushSubscription (see serializer listed in the WebIDL)')}}{{Spec2('Push API')}}初期定義。
+ +

ブラウザ実装状況

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
機能ChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
基本サポート{{CompatChrome(42.0)}}{{CompatGeckoDesktop(46.0)}}[1]{{CompatNo}}{{CompatUnknown}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
機能AndroidAndroid WebviewFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari MobileChrome for Android
基本サポート{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile(48)}}[2]{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatChrome(42.0)}}
+
+ + + +

関連項目

+ + diff --git a/files/ja/web/api/pushsubscription/unsubscribe/index.html b/files/ja/web/api/pushsubscription/unsubscribe/index.html new file mode 100644 index 0000000000..3e73b98e19 --- /dev/null +++ b/files/ja/web/api/pushsubscription/unsubscribe/index.html @@ -0,0 +1,127 @@ +--- +title: PushSubscription.unsubscribe() +slug: Web/API/PushSubscription/unsubscribe +tags: + - API + - Experimental + - Method + - Push + - Push API + - PushSubscription + - Reference + - Service Workers + - unsubscribe +translation_of: Web/API/PushSubscription/unsubscribe +--- +

{{SeeCompatTable}}{{APIRef("Push API")}}

+ +

{{domxref("PushSubscription")}} インターフェースの unsubscribe() メソッドは、現在のサブスクリプションが成功裏に登録解除されたときに {{domxref("Boolean")}} で解決される{{domxref("Promise")}} を返します。

+ +

構文

+ +
​PushSubscription.unsubscribe().then(function(Boolean) { ... });
+ +

パラメーター

+ +

なし。

+ +

戻り値

+ +

現在のサブスクリプションが成功裏に登録解除されたときに {{domxref("Boolean")}} で解決される{{domxref("Promise")}}。

+ +

+ +
navigator.serviceWorker.ready.then(function(reg) {
+  reg.pushManager.getSubscription().then(function(subscription) {
+    subscription.unsubscribe().then(function(successful) {
+      // 登録解除が成功
+    }).catch(function(e) {
+      // 登録解除が失敗
+    })
+  })
+});
+ +

仕様

+ + + + + + + + + + + + + + +
仕様状態コメント
{{SpecName('Push API','#widl-PushSubscription-unsubscribe-Promise-boolean','unsubscribe()')}}{{Spec2('Push API')}}初期定義。
+ +

ブラウザ実装状況

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
機能ChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
基本サポート{{CompatChrome(42.0)}}{{CompatGeckoDesktop(44.0)}}[1]{{CompatNo}}{{CompatUnknown}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
機能AndroidAndroid WebviewFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari MobileChrome for Android
基本サポート{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile(48)}}[2]{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatNo}}{{CompatChrome(42.0)}}
+
+ + + +

関連項目

+ + -- cgit v1.2.3-54-g00ecf