Impossible to connect a client to a remote socket on AWS
I m facing an issue with an fresh dev with socket.io
I got a socket.io server that is running on a AWS EC2 instance. It's a single instance with a public (55.55.55.55) and a private ip address ( 10.0.1.1 ) on port 10000
I start the server, and then i go to a website i created on another EC2 instance which is in another VPC ( 10.5.1.1/16 ) and another public ip address 100.100.100.100
This is the code i run on this instance, the client side of the websocket ( display a simple chat test )
<script>
const display_panel = document.getElementById('ws');
const number_of_lines_displayed = document.getElementById('info_lines');
let socket = io('http://55.55.55.55:10000');
let line_counter = 0;
socket.on('test', (msg) => {
if(line_counter < {{ max_lines }})
{
let span = document.createElement('span');
let text = document.createTextNode(msg);
let newline = document.createElement('br');
span.appendChild(text);
display_panel.insertBefore(newline, display_panel.firstChild);
display_panel.insertBefore(span, display_panel.firstChild);
number_of_lines_displayed.innerHTML = 'line(s): ' + line_counter++;
}
});
</script>
Then , i got a connection timeout.
On the server side, i ve start the server trying all the possible solution , but i was not able to connect in all the situation
- 10.0.1.1:10000
- 127.0.0.1:10000
- 0.0.0.0:10000
- 55.55.55.55:10000
in this last case, the server give me this error
Bugsnag: Encountered an uncaught error, terminating…
1|test | Error: listen EADDRNOTAVAIL 55.55.55.55:10000
1|test | at Object._errnoException (util.js:992:11)
1|test | at _exceptionWithHostPort (util.js:1014:20)
1|test | at Server.setupListenHandle [as _listen2] (net.js:1338:19)
1|test | at listenInCluster (net.js:1396:12)
1|test | at doListen (net.js:1505:7)
1|test | at _combinedTickCallback (internal/process/next_tick.js:141:11)
1|test | at process._tickDomainCallback (internal/process/next_tick.js:218:9)
1|test | at Function.Module.runMain (module.js:695:11)
1|test | at startup (bootstrap_node.js:191:16)
1|test | at bootstrap_node.js:612:3
I don't see how i can make this thing working. As i m trying to reach public ip, i should not need a bridge between the VPC ( would be my favourite solution )
Netstat give me this in all case
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 10.0.1.1:10000 0.0.0.0:* LISTEN 18132/test.js
Everything is working fine on local environment, so the code is not the issue, it look mainly to be a network issue.
Thanks for the help !
amazon-web-services amazon-ec2 websocket socket.io
add a comment |
I m facing an issue with an fresh dev with socket.io
I got a socket.io server that is running on a AWS EC2 instance. It's a single instance with a public (55.55.55.55) and a private ip address ( 10.0.1.1 ) on port 10000
I start the server, and then i go to a website i created on another EC2 instance which is in another VPC ( 10.5.1.1/16 ) and another public ip address 100.100.100.100
This is the code i run on this instance, the client side of the websocket ( display a simple chat test )
<script>
const display_panel = document.getElementById('ws');
const number_of_lines_displayed = document.getElementById('info_lines');
let socket = io('http://55.55.55.55:10000');
let line_counter = 0;
socket.on('test', (msg) => {
if(line_counter < {{ max_lines }})
{
let span = document.createElement('span');
let text = document.createTextNode(msg);
let newline = document.createElement('br');
span.appendChild(text);
display_panel.insertBefore(newline, display_panel.firstChild);
display_panel.insertBefore(span, display_panel.firstChild);
number_of_lines_displayed.innerHTML = 'line(s): ' + line_counter++;
}
});
</script>
Then , i got a connection timeout.
On the server side, i ve start the server trying all the possible solution , but i was not able to connect in all the situation
- 10.0.1.1:10000
- 127.0.0.1:10000
- 0.0.0.0:10000
- 55.55.55.55:10000
in this last case, the server give me this error
Bugsnag: Encountered an uncaught error, terminating…
1|test | Error: listen EADDRNOTAVAIL 55.55.55.55:10000
1|test | at Object._errnoException (util.js:992:11)
1|test | at _exceptionWithHostPort (util.js:1014:20)
1|test | at Server.setupListenHandle [as _listen2] (net.js:1338:19)
1|test | at listenInCluster (net.js:1396:12)
1|test | at doListen (net.js:1505:7)
1|test | at _combinedTickCallback (internal/process/next_tick.js:141:11)
1|test | at process._tickDomainCallback (internal/process/next_tick.js:218:9)
1|test | at Function.Module.runMain (module.js:695:11)
1|test | at startup (bootstrap_node.js:191:16)
1|test | at bootstrap_node.js:612:3
I don't see how i can make this thing working. As i m trying to reach public ip, i should not need a bridge between the VPC ( would be my favourite solution )
Netstat give me this in all case
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 10.0.1.1:10000 0.0.0.0:* LISTEN 18132/test.js
Everything is working fine on local environment, so the code is not the issue, it look mainly to be a network issue.
Thanks for the help !
amazon-web-services amazon-ec2 websocket socket.io
add a comment |
I m facing an issue with an fresh dev with socket.io
I got a socket.io server that is running on a AWS EC2 instance. It's a single instance with a public (55.55.55.55) and a private ip address ( 10.0.1.1 ) on port 10000
I start the server, and then i go to a website i created on another EC2 instance which is in another VPC ( 10.5.1.1/16 ) and another public ip address 100.100.100.100
This is the code i run on this instance, the client side of the websocket ( display a simple chat test )
<script>
const display_panel = document.getElementById('ws');
const number_of_lines_displayed = document.getElementById('info_lines');
let socket = io('http://55.55.55.55:10000');
let line_counter = 0;
socket.on('test', (msg) => {
if(line_counter < {{ max_lines }})
{
let span = document.createElement('span');
let text = document.createTextNode(msg);
let newline = document.createElement('br');
span.appendChild(text);
display_panel.insertBefore(newline, display_panel.firstChild);
display_panel.insertBefore(span, display_panel.firstChild);
number_of_lines_displayed.innerHTML = 'line(s): ' + line_counter++;
}
});
</script>
Then , i got a connection timeout.
On the server side, i ve start the server trying all the possible solution , but i was not able to connect in all the situation
- 10.0.1.1:10000
- 127.0.0.1:10000
- 0.0.0.0:10000
- 55.55.55.55:10000
in this last case, the server give me this error
Bugsnag: Encountered an uncaught error, terminating…
1|test | Error: listen EADDRNOTAVAIL 55.55.55.55:10000
1|test | at Object._errnoException (util.js:992:11)
1|test | at _exceptionWithHostPort (util.js:1014:20)
1|test | at Server.setupListenHandle [as _listen2] (net.js:1338:19)
1|test | at listenInCluster (net.js:1396:12)
1|test | at doListen (net.js:1505:7)
1|test | at _combinedTickCallback (internal/process/next_tick.js:141:11)
1|test | at process._tickDomainCallback (internal/process/next_tick.js:218:9)
1|test | at Function.Module.runMain (module.js:695:11)
1|test | at startup (bootstrap_node.js:191:16)
1|test | at bootstrap_node.js:612:3
I don't see how i can make this thing working. As i m trying to reach public ip, i should not need a bridge between the VPC ( would be my favourite solution )
Netstat give me this in all case
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 10.0.1.1:10000 0.0.0.0:* LISTEN 18132/test.js
Everything is working fine on local environment, so the code is not the issue, it look mainly to be a network issue.
Thanks for the help !
amazon-web-services amazon-ec2 websocket socket.io
I m facing an issue with an fresh dev with socket.io
I got a socket.io server that is running on a AWS EC2 instance. It's a single instance with a public (55.55.55.55) and a private ip address ( 10.0.1.1 ) on port 10000
I start the server, and then i go to a website i created on another EC2 instance which is in another VPC ( 10.5.1.1/16 ) and another public ip address 100.100.100.100
This is the code i run on this instance, the client side of the websocket ( display a simple chat test )
<script>
const display_panel = document.getElementById('ws');
const number_of_lines_displayed = document.getElementById('info_lines');
let socket = io('http://55.55.55.55:10000');
let line_counter = 0;
socket.on('test', (msg) => {
if(line_counter < {{ max_lines }})
{
let span = document.createElement('span');
let text = document.createTextNode(msg);
let newline = document.createElement('br');
span.appendChild(text);
display_panel.insertBefore(newline, display_panel.firstChild);
display_panel.insertBefore(span, display_panel.firstChild);
number_of_lines_displayed.innerHTML = 'line(s): ' + line_counter++;
}
});
</script>
Then , i got a connection timeout.
On the server side, i ve start the server trying all the possible solution , but i was not able to connect in all the situation
- 10.0.1.1:10000
- 127.0.0.1:10000
- 0.0.0.0:10000
- 55.55.55.55:10000
in this last case, the server give me this error
Bugsnag: Encountered an uncaught error, terminating…
1|test | Error: listen EADDRNOTAVAIL 55.55.55.55:10000
1|test | at Object._errnoException (util.js:992:11)
1|test | at _exceptionWithHostPort (util.js:1014:20)
1|test | at Server.setupListenHandle [as _listen2] (net.js:1338:19)
1|test | at listenInCluster (net.js:1396:12)
1|test | at doListen (net.js:1505:7)
1|test | at _combinedTickCallback (internal/process/next_tick.js:141:11)
1|test | at process._tickDomainCallback (internal/process/next_tick.js:218:9)
1|test | at Function.Module.runMain (module.js:695:11)
1|test | at startup (bootstrap_node.js:191:16)
1|test | at bootstrap_node.js:612:3
I don't see how i can make this thing working. As i m trying to reach public ip, i should not need a bridge between the VPC ( would be my favourite solution )
Netstat give me this in all case
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 10.0.1.1:10000 0.0.0.0:* LISTEN 18132/test.js
Everything is working fine on local environment, so the code is not the issue, it look mainly to be a network issue.
Thanks for the help !
amazon-web-services amazon-ec2 websocket socket.io
amazon-web-services amazon-ec2 websocket socket.io
asked Nov 16 '18 at 9:34
Chris
161
161
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Found the issue : We needed to open the port in the AWS console on the EC2 instance.
Instance > security group > inbound rule
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53335007%2fimpossible-to-connect-a-client-to-a-remote-socket-on-aws%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Found the issue : We needed to open the port in the AWS console on the EC2 instance.
Instance > security group > inbound rule
add a comment |
Found the issue : We needed to open the port in the AWS console on the EC2 instance.
Instance > security group > inbound rule
add a comment |
Found the issue : We needed to open the port in the AWS console on the EC2 instance.
Instance > security group > inbound rule
Found the issue : We needed to open the port in the AWS console on the EC2 instance.
Instance > security group > inbound rule
answered Nov 19 '18 at 13:49
Chris
161
161
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53335007%2fimpossible-to-connect-a-client-to-a-remote-socket-on-aws%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown