Files
docker-docs/ee/ucp/interlock/usage/websockets.md
Maria Bermudez 21b6302bf3 Revert "Netlify redirects interlock (#8595)"
This reverts commit a7793edc74.
2019-04-18 13:41:45 -06:00

1.1 KiB

title, description, keywords
title description keywords
Use websockets Learn how to use websockets in your swarm services. routing, proxy, websockets

First, create an overlay network to isolate and secure service traffic:

$> docker network create -d overlay demo
1se1glh749q1i4pw0kf26mfx5

Next, create the service with websocket endpoints:

$> docker service create \
    --name demo \
    --network demo \
    --detach=false \
    --label com.docker.lb.hosts=demo.local \
    --label com.docker.lb.port=8080 \
    --label com.docker.lb.websocket_endpoints=/ws \
    ehazlett/websocket-chat

Note

: for this to work, you must have an entry for demo.local in your local hosts (i.e. /etc/hosts) file. This uses the browser for websocket communication, so you must have an entry or use a routable domain.

Interlock detects when the service is available and publishes it. Once tasks are running and the proxy service is updated, the application should be available via http://demo.local. Open two instances of your browser and text should be displayed on both instances as you type.