Websocket error undefined

Dear aws contributors, {[DEBUG] 05:15.670 AuthClass - getting session failed: "No userPool"} ConsoleLogger.js:84 [DEBUG] 05:15.672 Credentials - setting credentials for guest ConsoleLogge...

Query and Mutation works fine. But subscription failed.

LibraryFactory.ClientImpl._disconnected(), paho-mqtt.js:1617
LibraryFactory.ClientImpl._on_socket_error(), paho-mqtt.js:1450
anonymous(), paho-mqtt.js:181
onError(), event-target.js:128
emit(), events.js:182
EventEmitter.emit(), domain.js:442
abortHandshake(), websocket.js:648
req.on(), websocket.js:535
emit(), events.js:182
EventEmitter.emit(), domain.js:442
parserOnIncomingClient(), _http_client.js:546
parserOnHeadersComplete(), _http_common.js:109
socketOnData(), _http_client.js:432
emit(), events.js:182
EventEmitter.emit(), domain.js:442
addChunk(), _stream_readable.js:279
readableAddChunk(), _stream_readable.js:264
Readable.push(), _stream_readable.js:219
onread(), net.js:636
Async call from HTTPPARSER
init(), inspector_async_hook.js:27
emitInitNative(), async_hooks.js:137
tickOnSocket(), _http_client.js:619
onSocketNT(), _http_client.js:667
_tickCallback(), next_tick.js:63
Async call from TickObject
init(), inspector_async_hook.js:27
emitInitNative(), async_hooks.js:137
emitInitScript(), async_hooks.js:336
TickObject(), next_tick.js:86
nextTick(), next_tick.js:117
onSocket(), _http_client.js:655
ClientRequest(), _http_client.js:248
request(), https.js:272
get(), https.js:276
initAsClient(), websocket.js:514
WebSocket(), websocket.js:62
LibraryFactory.ClientImpl._doConnect(), paho-mqtt.js:1050
LibraryFactory.ClientImpl.connect(), paho-mqtt.js:886
Client.connect(), paho-mqtt.js:2025
anonymous(), subscription-handshake-link.js:117
SubscriptionHandshakeLink._this.connect(), subscription-handshake-link.js:116
SubscriptionHandshakeLink._this.connectAll(), subscription-handshake-link.js:105
_tickCallback(), next_tick.js:68
Async call from Promise.then
anonymous(), subscription-handshake-link.js:176
Subscription(), Observable.js:179
subscribe(), Observable.js:258
anonymous(), index.ts:24
_tickCallback(), next_tick.js:68
Async call from Promise.then
anonymous(), index.ts:23
Subscription(), Observable.js:179
subscribe(), Observable.js:258
anonymous(), auth-link.js:192
_tickCallback(), next_tick.js:68
Module.runMain(), loader.js:746
startup(), node.js:238
bootstrapNodeJSCore(), node.js:572
Async call from Promise.then
anonymous(), auth-link.js:191
Subscription(), Observable.js:179
subscribe(), Observable.js:258
anonymous(), complex-object-link.js:88
_tickCallback(), next_tick.js:68
Module.runMain(), loader.js:746
startup(), node.js:238
bootstrapNodeJSCore(), node.js:572
Async call from Promise.then
anonymous(), complex-object-link.js:87
Subscription(), Observable.js:179
subscribe(), Observable.js:258
anonymous(), client.js:120
_tickCallback(), next_tick.js:68
Module.runMain(), loader.js:746
startup(), node.js:238
bootstrapNodeJSCore(), node.js:572
Async call from Promise.then
anonymous(), client.js:119
Subscription(), Observable.js:179
subscribe(), Observable.js:258
anonymous(), QueryManager.ts:958
Subscription(), Observable.js:179
subscribe(), Observable.js:258
anonymous(), request-subscribe-on-update-setting.ts:20
fulfilled(), request-subscribe-on-update-setting.js:4
_tickCallback(), next_tick.js:68
Module.runMain(), loader.js:746
startup(), node.js:238
bootstrapNodeJSCore(), node.js:572
Async call from Promise.then
step(), request-subscribe-on-update-setting.js:6
anonymous(), request-subscribe-on-update-setting.js:7
__awaiter(), request-subscribe-on-update-setting.js:3
exports.default(), request-subscribe-on-update-setting.ts:9
anonymous(), index.ts:125
Module._compile(), loader.js:699
Module._extensions..js(), loader.js:713
Module.load(), loader.js:612
tryModuleLoad(), loader.js:551
Module._load(), loader.js:543
Module.runMain(), loader.js:744
startup(), node.js:238
bootstrapNodeJSCore(), node.js:572

Debugging it further 8 level up from stacktrace on req.on(), ws/lib/websocket.js:535 I got response with statusCode 403 and statusMessage «Forbidden»

  • Question

  • Hello,

    I have a problem to use Web Sockets from IE 10, sample applications (e.g.
    http://www.websocket.org/echo.html) fails.

    Developer console shows  «SCRIPT12008: WebSocket Error: Incorrect HTTP response. Status code 403, Forbidden» error to me and captured network traffic shows that IE even didn’t try to connect.

    It seems to be a particular box issue since it works ok on others but is there any setting that should be enabled to make it work?

    Thanks,

    Taras

All replies

  • Hi,

    WebSocket Test

    CONNECTED

    SENT: WebSocket rocks

    RESPONSE: WebSocket rocks

    DISCONNECTED

    here is the corrected for markup errors sample form websocket.org

    <!DOCTYPE html> 
    <!-- saved from url=(0014)about:internet -->
    <html>
    <head>
    <meta charset="utf-8" /> 
    <title>WebSocket Test</title> 
    <script type="text/javascript"> 
    var wsUri = "ws://echo.websocket.org/"; var output; 
    function init() { 
    output = document.getElementById("output"); 
    testWebSocket(); } function testWebSocket() { websocket = new WebSocket(wsUri); websocket.onopen = function(evt) { onOpen(evt) }; websocket.onclose = function(evt) { onClose(evt) }; websocket.onmessage = function(evt) { onMessage(evt) }; websocket.onerror = function(evt) { onError(evt) }; } function onOpen(evt) { writeToScreen("CONNECTED"); doSend("WebSocket rocks"); } function onClose(evt) { writeToScreen("DISCONNECTED"); } function onMessage(evt) { writeToScreen('<span style="color: blue;">RESPONSE: ' + evt.data+'</span>'); websocket.close(); } function onError(evt) { writeToScreen('<span style="color: red;">ERROR:</span> ' + evt.data); } function doSend(message) { writeToScreen("SENT: " + message); websocket.send(message); } function writeToScreen(message) { var pre = document.createElement("p"); pre.style.wordWrap = "break-word"; pre.innerHTML = message; output.appendChild(pre); } window.addEventListener("load", init, false); </script>
    </head>
    <body>
    <h2>WebSocket Test</h2> <div id="output"></div> 
    </body>
    


    Rob^_^

  • This is what I receive instead:

    WebSocket Test

    ERROR: undefined

    DISCONNECTED

    The problem is not with the sample but with this specific IE installation.

    IE version: 10.0.9200.16618, Operation System: Windows 7 SP1 (64 bit)

    Taras

  • f12,click «Start Debugging»…. that is an error message…  FROM THE WEB PAGE. To find out the js error (viz what is undefined)… use the Developer tool.

    or

    use the corrected source code provided.

    for general questions about IE user settings please post your question to
    http://answers.microsoft.com


    Rob^_^

  • I already mentioned the error from f12 in my first post, it is
    «SCRIPT12008: WebSocket Error: Incorrect HTTP response. Status code 403, Forbidden»

  • Well, I was not able to fix the problem, enabling Web Sockets feature explicitly (http://msdn.microsoft.com/en-us/library/ee330736(v=vs.85).aspx#websocket) didn’t help.

    Any ideas what the mentioned
    SCRIPT12008 error means?

    Rob,

    I’m not sure what you mean under «or use
    the corrected source code provided.
    » since I used the provided source code and posted its output above.

    Taras

Oliver Batchelor

unread,

Mar 30, 2015, 5:01:44 AM3/30/15

to elm-d…@googlegroups.com

Hi guys, 

I’ve been trying to make a little multi-player game using Haskell/Elm and Websockets, and I’ve run into this problem trying to get the client to respond to messages from the server. As you see the clientMessages and serverMessages are defined in terms of each other which seems to cause a problem and I get this error:

Cannot read property ‘value’ of undefined

I’ve tried various things to try and break the cycle (e.g. using keepIf, merging the signal with a constant value etc.) but none successful so far. 

If anyone can point me in the right direction, that’d be great!

Thanks!

Oliver

import Html

import String

import WebSocket

import Signal (keepWhen, Signal, constant, merge)

import Signal

clientMessages : Signal String

clientMessages = Signal.map String.toUpper serverMessages

serverMessages : Signal String

serverMessages = WebSocket.connect «ws://localhost:9160» clientMessages

view : String -> Html.Html

view str = Html.text str

main = Signal.map view clientMessages

Oliver Batchelor

unread,

Mar 30, 2015, 10:26:01 AM3/30/15

to elm-d…@googlegroups.com

So, I understand this is a lot of what the changes for 0.15 are designed to fix, to facilitate events via «Streams» because of just this problem.

I guess all that needs to be done is to implement a web sockets interface in terms of the new primitives. Was having a look at the new elm-http and it seems quite a bit to learn to do it properly. Do websockets also need to deal with the binary/string data division that the http interface deals with?

Alex Neslusan

unread,

Mar 30, 2015, 10:50:16 AM3/30/15

to elm-d…@googlegroups.com

The basic problem is that you can’t define Signals cyclically. That is, a Signal cannot be defined in terms of itself or in terms of other Signals that are defined in terms of it. I think this is one of the things that should be easier to do in 0.15, and for now, you can use an outgoing and incoming port and manage it in Javascript yourself.

Oliver Batchelor

unread,

Mar 31, 2015, 3:07:32 AM3/31/15

to elm-d…@googlegroups.com

Alright, thanks for that, seems quite a manageable approach.

Oliver

Понравилась статья? Поделить с друзьями:
  • Websocket error network error 12030 подключение к серверу было неожиданно прервано
  • Websocket error event
  • Websocket error during websocket handshake unexpected response code 200
  • Websocket connection to wss failed error during websocket handshake unexpected response code 400
  • Websocket connection to failed error in connection establishment