using port 80 in Websocket server - websocket

I am developing a chat server in php using html 5 and Websocket
I want to connect the websocket to a subdomain with port 80 using something like the following code:
var ws = new WebSocket("ws://subdomain.mydomain.com:80");
How can my Apache sever listen to port 80.Is it even possible or not.
If it's not possible , is there a way by which i can forward data from port 80 to another port(ex:8080)
The reason why i am doing so is that i wanna use the websocket beside proxy.
Is there any other solution handling this issue .

Related

Command to check if can access to Websocket address & port

I'm looking for a command like:
ping google.com
But I also want to use the port, like google.com:8080
I want to know if a client can connect to my servers socket listener at a certain port.
My core problem is, 100% of users are able to connect to my websocket port at 8080, but only single digit x% are able to connect to websocket port at 2053. This is independent of device. After research I've found out that some ISPs might be blocking this port.

Modify cloudera manager port 7180 to 80

My server offered by boss can access by port 80.
How can I configure the Web UI port 7180 to 80?
It doesn't work that I modified the server_port in /etc/cloudera-scm-agent/config.ini
I can't access the UI, so the following does not work:
Cloudera Server Ports
I need configure it in config files.
I have strong belief that you should NOT change this port. It's possible in general, however you may meet some issues like those one in your case.
I can suggest you to use reverse proxy server such as Nginx or Apache. It's much safer and maybe even faster.
So as result I'll get the following proxying chain which is fully transparent to clients:
Client (your Boss) connects to server via port 80
Nginx (or Apache) is listening port 80
Nginx sends HTTP requests to Cloudera on port 7180
Nginx returns request result to client (your Boss)

Port Config in amazon ec2 for WebSocket

I am trying to write something on WebSocket with Amazon ws. The problem is that I can not open the port by running this :
conn = new WebSocket('ws://ec2-54-213-181-25.us-west-2.compute.amazonaws.com:8081');
My port config on inbound and outbound in security for TCP and ICMP are all range 0-65535 and destination 0.0.0.0/0. But I still cannot open port 8081.
Can anyone tell me the wrong thing I did?
You have to create your websocket in private ip of Your EC2. Then you can connect your websocket using your public ip or url with port number
Pointed out that I need to open the port by this way :
socket = io.connect("abc:123");
so they are the same websocket version

What port does sending tweets via the Twitter api use?

I would like to use the code at this link to send tweets from Oracle PL/SQL. However I have to convince the network administrator to open up the port on the DMZ firewall in order to do this. So my question is what port would that code need so that I can tell them to open that port. Is it just port 80 for html, so nothing has to be opened?
There's this: Twitter Development Talk
The Twitter API runs on standard web service ports: Port 80 for non-secure traffic and Port 443 for SSL-based traffic.

Socket.io 404es on Heroku on every port I tried

I have the app running and it doesn't find socket.io and gives me 404.
this is the client:
<script src="http://game-test-1.herokuapp.com/socket.io/socket.io.js"></script>
<script>var socket = io.connect('http://game-test-1.herokuapp.com');</script>
and this is the server:
var express = require('express'),
routes = require('./routes'),
user = require('./routes/user'),
http = require('http'),
path = require('path'),
express = require("express"),
app = express(),
server = http.createServer(app),
io = require('socket.io').listen(server);
server.listen(80);
I tried changing the ports and doing http://game-test-1.herokuapp.com:81/... but that gave me an error
How do I link socket.io correctly?
Heroku requires that your application listens on a port of Heroku's choosing. Heroku will tell your application this port when it launches your application, via the PORT environment variable. If you listen on any other port, Heroku will ignore it and will terminate your application after 60 seconds.
Your users' browsers will still use ports 80 for HTTP traffic and 443 for HTTPS traffic. Heroku's routing layer, which is in-between the user's browser and your application, will send the HTTP traffic through to your application at the port Heroku designated for your application.
Heroku Dev Center has a guide on using socket.io on Heroku. In particular, you'll need this bit of config:
// assuming io is the Socket.IO server object
io.configure(function () {
io.set("transports", ["xhr-polling"]);
io.set("polling duration", 10);
});
This is because Heroku does not support Websockets at this time (to the best of my knowledge) In order to use socket.io you need to force it to fallback to an xhr long-polling approach.

Resources