ALB - Websocket connection keeps getting terminated
I have a front-end application that tries to connect to a socket.io backend on port 3000. Both are implemented as Microservices in aws. I have set ListenerRule
and TargetGroup
for the socket.io service as below,
TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
VpcId: !Ref VPC
Port: 3000
Protocol: HTTP
Matcher:
HttpCode: 200-299
HealthCheckIntervalSeconds: 10
HealthCheckPath: /
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 5
HealthyThresholdCount: 2
ListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 4
Conditions:
- Field: path-pattern
Values: [ "/" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
ListenerRule1:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 5
Conditions:
- Field: path-pattern
Values: [ "/socket.io/" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
ListenerRule2:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 6
Conditions:
- Field: path-pattern
Values: [ "/socket.io/*" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
But the connection keeps getting disconnected like once every second.
I wanted to try the stickiness option as the Application Load Balancer I'm using is supporting websockets. But couldn't find a proper document on how to do that with a yaml script update.
amazon-web-services aws-application-load-balancer
add a comment |
I have a front-end application that tries to connect to a socket.io backend on port 3000. Both are implemented as Microservices in aws. I have set ListenerRule
and TargetGroup
for the socket.io service as below,
TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
VpcId: !Ref VPC
Port: 3000
Protocol: HTTP
Matcher:
HttpCode: 200-299
HealthCheckIntervalSeconds: 10
HealthCheckPath: /
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 5
HealthyThresholdCount: 2
ListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 4
Conditions:
- Field: path-pattern
Values: [ "/" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
ListenerRule1:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 5
Conditions:
- Field: path-pattern
Values: [ "/socket.io/" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
ListenerRule2:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 6
Conditions:
- Field: path-pattern
Values: [ "/socket.io/*" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
But the connection keeps getting disconnected like once every second.
I wanted to try the stickiness option as the Application Load Balancer I'm using is supporting websockets. But couldn't find a proper document on how to do that with a yaml script update.
amazon-web-services aws-application-load-balancer
add a comment |
I have a front-end application that tries to connect to a socket.io backend on port 3000. Both are implemented as Microservices in aws. I have set ListenerRule
and TargetGroup
for the socket.io service as below,
TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
VpcId: !Ref VPC
Port: 3000
Protocol: HTTP
Matcher:
HttpCode: 200-299
HealthCheckIntervalSeconds: 10
HealthCheckPath: /
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 5
HealthyThresholdCount: 2
ListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 4
Conditions:
- Field: path-pattern
Values: [ "/" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
ListenerRule1:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 5
Conditions:
- Field: path-pattern
Values: [ "/socket.io/" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
ListenerRule2:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 6
Conditions:
- Field: path-pattern
Values: [ "/socket.io/*" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
But the connection keeps getting disconnected like once every second.
I wanted to try the stickiness option as the Application Load Balancer I'm using is supporting websockets. But couldn't find a proper document on how to do that with a yaml script update.
amazon-web-services aws-application-load-balancer
I have a front-end application that tries to connect to a socket.io backend on port 3000. Both are implemented as Microservices in aws. I have set ListenerRule
and TargetGroup
for the socket.io service as below,
TargetGroup:
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Properties:
VpcId: !Ref VPC
Port: 3000
Protocol: HTTP
Matcher:
HttpCode: 200-299
HealthCheckIntervalSeconds: 10
HealthCheckPath: /
HealthCheckProtocol: HTTP
HealthCheckTimeoutSeconds: 5
HealthyThresholdCount: 2
ListenerRule:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 4
Conditions:
- Field: path-pattern
Values: [ "/" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
ListenerRule1:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 5
Conditions:
- Field: path-pattern
Values: [ "/socket.io/" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
ListenerRule2:
Type: AWS::ElasticLoadBalancingV2::ListenerRule
Properties:
ListenerArn: !Ref Listener
Priority: 6
Conditions:
- Field: path-pattern
Values: [ "/socket.io/*" ]
Actions:
- TargetGroupArn: !Ref TargetGroup
Type: forward
But the connection keeps getting disconnected like once every second.
I wanted to try the stickiness option as the Application Load Balancer I'm using is supporting websockets. But couldn't find a proper document on how to do that with a yaml script update.
amazon-web-services aws-application-load-balancer
amazon-web-services aws-application-load-balancer
asked Jan 1 at 12:23
Ammar Ibnu AmeerdeenAmmar Ibnu Ameerdeen
4401316
4401316
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The load balancer is not suitable for long time web socket connections and will terminate your connection after
certain time.
You can increase the timeout to a maximum of 4000 seconds.
But AWS Api-Gateway added a new feature for websockets you can maybe use with AWS Lambda.
More Info here: Api-Gateway Websockets
You can have a look a serverless example with websockets.
I hope that helps.
Dominik
ALB is an Application Load Balancer. "The Application Load Balancer is designed to handle streaming, real-time, and WebSocket workloads in an optimized fashion."
– Michael - sqlbot
Jan 1 at 20:31
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%2f53995396%2falb-websocket-connection-keeps-getting-terminated%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
The load balancer is not suitable for long time web socket connections and will terminate your connection after
certain time.
You can increase the timeout to a maximum of 4000 seconds.
But AWS Api-Gateway added a new feature for websockets you can maybe use with AWS Lambda.
More Info here: Api-Gateway Websockets
You can have a look a serverless example with websockets.
I hope that helps.
Dominik
ALB is an Application Load Balancer. "The Application Load Balancer is designed to handle streaming, real-time, and WebSocket workloads in an optimized fashion."
– Michael - sqlbot
Jan 1 at 20:31
add a comment |
The load balancer is not suitable for long time web socket connections and will terminate your connection after
certain time.
You can increase the timeout to a maximum of 4000 seconds.
But AWS Api-Gateway added a new feature for websockets you can maybe use with AWS Lambda.
More Info here: Api-Gateway Websockets
You can have a look a serverless example with websockets.
I hope that helps.
Dominik
ALB is an Application Load Balancer. "The Application Load Balancer is designed to handle streaming, real-time, and WebSocket workloads in an optimized fashion."
– Michael - sqlbot
Jan 1 at 20:31
add a comment |
The load balancer is not suitable for long time web socket connections and will terminate your connection after
certain time.
You can increase the timeout to a maximum of 4000 seconds.
But AWS Api-Gateway added a new feature for websockets you can maybe use with AWS Lambda.
More Info here: Api-Gateway Websockets
You can have a look a serverless example with websockets.
I hope that helps.
Dominik
The load balancer is not suitable for long time web socket connections and will terminate your connection after
certain time.
You can increase the timeout to a maximum of 4000 seconds.
But AWS Api-Gateway added a new feature for websockets you can maybe use with AWS Lambda.
More Info here: Api-Gateway Websockets
You can have a look a serverless example with websockets.
I hope that helps.
Dominik
answered Jan 1 at 13:50
DominikHelpsDominikHelps
1293
1293
ALB is an Application Load Balancer. "The Application Load Balancer is designed to handle streaming, real-time, and WebSocket workloads in an optimized fashion."
– Michael - sqlbot
Jan 1 at 20:31
add a comment |
ALB is an Application Load Balancer. "The Application Load Balancer is designed to handle streaming, real-time, and WebSocket workloads in an optimized fashion."
– Michael - sqlbot
Jan 1 at 20:31
ALB is an Application Load Balancer. "The Application Load Balancer is designed to handle streaming, real-time, and WebSocket workloads in an optimized fashion."
– Michael - sqlbot
Jan 1 at 20:31
ALB is an Application Load Balancer. "The Application Load Balancer is designed to handle streaming, real-time, and WebSocket workloads in an optimized fashion."
– Michael - sqlbot
Jan 1 at 20:31
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.
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%2f53995396%2falb-websocket-connection-keeps-getting-terminated%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