2017-10-04 14 views
2

wsをwssに変更する手順は何ですか?wsとwssの違いは?

wssが通常のHTTP経由でアップグレードをアップグレードするのか、wssはHTTPSのみで動作するのか。

Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR

答えて

6

ショートバージョンSSLかSSL

webSocket = new WebSocket("ws://localhost:port/Esv/ocp"); 

は、私はそれがこのエラーを示し

webSocket = new WebSocket("wss://localhost:port/Esv/ocp"); 

WSSするWSを変更したときに、正常に動作します

SSL certificate issueがあります。接続点ルールは、summarized asとすることができる:

  • wsshttps only
  • wsに接続http

その逆に接続している:

  • https

    次のような状況があなたにトンをリードするws only

エラーをwss only

  • http受け入れる受け入れOエラー(Firefoxの下で行わテスト):あなたはhttpエンドポイントへwss接続を接続したい場合は

    • 。私のテストでは、私が持っていたあなたがhttpsエンドポイントへws接続を接続したい場合は、あなたが

      SecurityError: The operation is insecure.

    フォーマル答え

    の聖書を誤りがあるでしょう

    InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable

  • ウェブソケットはRFC 6455です。セクション4.1.5で:

    If /secure/ is true, the client MUST perform a TLS handshake over the connection after opening the connection and before sending the handshake data [RFC2818]. If this fails (e.g., the server's certificate could not be verified), then the client MUST Fail the WebSocket Connection and abort the connection. Otherwise, all further communication on this channel MUST run through the encrypted tunnel [RFC5246].

    セキュアフラグは、URIによって定義されます。第3節では安全な

    The URI is called "secure" (and it is said that "the secure flag is set") if the scheme component matches "wss" case-insensitively.


    TLが何であるかを定義します。DR

    使用したい場合はwss

    • あなたはSSLが
    • エンドポイントのポイントが必要有効にする必要があります(https://...): "セキュリティダウングレード"は許可されていません

    あなたはwsを使用したい場合:

    • あなたのエンドポイントがSSLを有効にしていないことを確認してください(http://...
  • +0

    はyou..AndはWSSはまた、HTTPのために働くことは本当に可能ですありがとう? – mahe

    +0

    いいえ、websocketは「セキュリティ」のダウングレードを許可していません。私はそれを強調するために私の答えを編集します。 – Al1

    +0

    @maheをフィードバックしていただきありがとうございます。あなたの質問に答えますか? – Al1