Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Remove unused socket code

Uku Taht9b0bd2162cfa
diff --git a/lib/plausible_web/channels/user_socket.ex b/lib/plausible_web/channels/user_socket.ex
deleted file mode 100644
index 2ec5fcba16..0000000000
--- a/lib/plausible_web/channels/user_socket.ex
+++ /dev/null
@@ -1,33 +0,0 @@
-defmodule PlausibleWeb.UserSocket do
- use Phoenix.Socket
-
- ## Channels
- # channel "room:*", PlausibleWeb.RoomChannel
-
- # Socket params are passed from the client and can
- # be used to verify and authenticate a user. After
- # verification, you can put default assigns into
- # the socket that will be set for all channels, ie
- #
- # {:ok, assign(socket, :user_id, verified_user_id)}
- #
- # To deny connection, return `:error`.
- #
- # See `Phoenix.Token` documentation for examples in
- # performing token verification on connect.
- def connect(_params, socket, _connect_info) do
- {:ok, socket}
- end
-
- # Socket id's are topics that allow you to identify all sockets for a given user:
- #
- # def id(socket), do: "user_socket:#{socket.assigns.user_id}"
- #
- # Would allow you to broadcast a "disconnect" event and terminate
- # all active sockets and channels for a given user:
- #
- # PlausibleWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
- #
- # Returning `nil` makes this socket anonymous.
- def id(_socket), do: nil
-end
diff --git a/lib/plausible_web/endpoint.ex b/lib/plausible_web/endpoint.ex
index 124a4918cf..b66811631b 100644
--- a/lib/plausible_web/endpoint.ex
+++ b/lib/plausible_web/endpoint.ex
@@ -2,10 +2,6 @@ defmodule PlausibleWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :plausible
use Sentry.Phoenix.Endpoint
- socket "/socket", PlausibleWeb.UserSocket,
- websocket: true,
- longpoll: false
-
# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phx.digest
diff --git a/test/support/channel_case.ex b/test/support/channel_case.ex
deleted file mode 100644
index 2880903192..0000000000
--- a/test/support/channel_case.ex
+++ /dev/null
@@ -1,37 +0,0 @@
-defmodule PlausibleWeb.ChannelCase do
- @moduledoc """
- This module defines the test case to be used by
- channel tests.
-
- Such tests rely on `Phoenix.ChannelTest` and also
- import other functionality to make it easier
- to build common data structures and query the data layer.
-
- Finally, if the test case interacts with the database,
- it cannot be async. For this reason, every test runs
- inside a transaction which is reset at the beginning
- of the test unless the test case is marked as async.
- """
-
- use ExUnit.CaseTemplate
-
- using do
- quote do
- # Import conveniences for testing with channels
- use Phoenix.ChannelTest
-
- # The default endpoint for testing
- @endpoint PlausibleWeb.Endpoint
- end
- end
-
- setup tags do
- :ok = Ecto.Adapters.SQL.Sandbox.checkout(Plausible.Repo)
-
- unless tags[:async] do
- Ecto.Adapters.SQL.Sandbox.mode(Plausible.Repo, {:shared, self()})
- end
-
- :ok
- end
-end