Skip to content
Snippets Groups Projects
Commit 5f4a7d5d authored by PUBERT Quentin's avatar PUBERT Quentin
Browse files

add custom http port and fixed non-accepted socket

parent 11b270a9
No related branches found
No related tags found
No related merge requests found
......@@ -6,13 +6,14 @@ defmodule Dunixir.Application do
use Application
def start(_type, _args) do
ws2p_port = String.to_integer(System.get_env("PORT") || "20900")
ws2p_port = String.to_integer(System.get_env("WS2P_PORT") || "20900")
http_port = String.to_integer(System.get_env("HTTP_PORT") || "8085")
children = [
# Starts a worker by calling: Dunixir.Worker.start_link(arg)
# {Dunixir.Worker, arg}
BDD.Create,
Plug.Adapters.Cowboy.child_spec(scheme: :http, plug: ServerHttp.Router, options: [port: 8085]),
Plug.Adapters.Cowboy.child_spec(scheme: :http, plug: ServerHttp.Router, options: [port: http_port]),
{Registry, keys: :unique, name: WS2P.Connection.Registry},
{DynamicSupervisor, strategy: :one_for_one, name: WS2P.ConnectionSupervisor},
WS2P.Cluster,
......
......@@ -24,6 +24,7 @@ defmodule WS2P.Endpoint do
defp loop(websocket_listener, path) do
client_socket = Socket.Web.accept!(websocket_listener)
if client_socket.path == path do
Socket.Web.accept!(client_socket)
start_connection!({:accept, client_socket})
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment