Bug 1123033 - Can not connect to Websocket on Openshift, works fine locally
Summary: Can not connect to Websocket on Openshift, works fine locally
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Master
Version: 2.x
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Lili Nader
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-24 16:39 UTC by Harit Himanshu
Modified: 2015-05-15 00:56 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-24 19:50:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Harit Himanshu 2014-07-24 16:39:24 UTC
Description of problem:
I have a project https://github.com/hhimanshu/tweetstream where I connect to server using websocket, see https://github.com/hhimanshu/tweetstream/blob/master/src/main/webapp/tweets.js#L19. This works fine when I run it locally on my laptop, but I see error when deployed to Openshift

I even tried port :8000, but no luck
var connection = new WebSocket('wss://'+ document.location.host + ':8000' + document.location.pathname + 'tweets');
  connection.onopen = function() {
    connection.send('brazil');
  };
  connection.onerror = function(error) {
    console.log('WebSocket Error ' + error);
  };
  connection.onmessage = function(e) {
    var parse = JSON.parse(e.data);
    var coordinates = parse["geo"]["coordinates"];
    console.log("coordinates:" + JSON.stringify(coordinates, undefined, 2));
  };

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. load app in browser http://map-tweetstream.rhcloud.com/
2. See console log for error
WebSocket connection to 'ws://map-tweetstream.rhcloud.com/tweets' failed: Error during WebSocket handshake: Unexpected response code: 404 tweets.js:19
WebSocket Error [object Event] 
3.

Actual results:


Expected results:


Additional info:


Note You need to log in before you can comment on or make changes to this bug.