diff --git a/files/ja/web/api/websockets_api/writing_websocket_client_applications/index.md b/files/ja/web/api/websockets_api/writing_websocket_client_applications/index.md index 50986d7f1ef215..c3434450313722 100644 --- a/files/ja/web/api/websockets_api/writing_websocket_client_applications/index.md +++ b/files/ja/web/api/websockets_api/writing_websocket_client_applications/index.md @@ -2,7 +2,7 @@ title: WebSocket クライアントアプリケーションを書く slug: Web/API/WebSockets_API/Writing_WebSocket_client_applications l10n: - sourceCommit: 4bd2e8957a40a8f31484f9aea3725bdfe78a921a + sourceCommit: 9a4005caa5cc13f5174e3b8981eeec5631ed83d1 --- {{DefaultAPISidebar("WebSockets API")}} {{AvailableInWorkers}} @@ -135,7 +135,7 @@ exampleSocket.onmessage = (event) => { ```js exampleSocket.onmessage = (event) => { - const f = document.getElementById("chatbox").contentDocument; + const f = document.getElementById("chat-box").contentDocument; let text = ""; const msg = JSON.parse(event.data); const time = new Date(msg.date); @@ -152,17 +152,17 @@ exampleSocket.onmessage = (event) => { case "message": text = `(${timeStr}) ${msg.name} : ${msg.text}
`; break; - case "rejectusername": + case "reject-username": text = `Your username has been set to ${msg.name} because the name you chose is in use.
`; break; - case "userlist": - document.getElementById("userlistbox").innerText = msg.users.join("\n"); + case "user-list": + document.getElementById("user-list-box").innerText = msg.users.join("\n"); break; } if (text.length) { f.write(text); - document.getElementById("chatbox").contentWindow.scrollByPages(1); + document.getElementById("chat-box").contentWindow.scrollByPages(1); } }; ``` @@ -186,5 +186,5 @@ exampleSocket.close(); ## セキュリティの考慮事項 -混合コンテンツ環境では WebSocket を使用しないでください。つまり、 HTTPS を使用もしくはそうでない方法でもロードされたページから、セキュアでない WebSocket 接続を開くべきではありません。 +混在コンテンツ環境では WebSocket を使用しないでください。つまり、 HTTPS を使用もしくはそうでない方法でもロードされたページから、セキュアでない WebSocket 接続を開くべきではありません。 最近のブラウザーは安全な WebSocket 接続のみを許可し、また安全ではないコンテキストでの使用には対応しなくなってきています。