JJs

JJs

Hello,

I’m attempting to use Tsung to load test a Phoenix LiveView website over WebSocket. I’ve tried searching online for examples, but I’ve only found examples of Tsung being used with the Phoenix framework, not specifically with Phoenix LiveView.

I’ve successfully configured the XML to establish a WebSocket connection, but I’m encountering an error on the server side when sending a WebSocket message. The following error occurs when sending the message [null,"1","phoenix","heartbeat",{}]:

09:01:59.514 [error] Ranch listener MyAppWeb.Endpoint.HTTP had connection process 
started with :cowboy_clear:start_link/4 at #PID<0.11462.0> exit with reason: 
{:function_clause, [{Phoenix.Socket.V2.JSONSerializer, :decode_binary, ["
[null,\"1\",\"phoenix\",\"heartbeat\",{}]"], []}, {Phoenix.Socket, :__in__, 2, [file: 
~c"lib/phoenix/socket.ex", line: 517]}, {WebSockAdapter.CowboyAdapter, 
:websocket_handle, 2, [file: ~c"lib/websock_adapter/cowboy_adapter.ex", line: 24]}, 
{:cowboy_websocket, :handler_call, 6, [file: 
~c"/buildroot/deps/cowboy/src/cowboy_websocket.erl", line: 528]}, {:cowboy_http, :loop, 
1, [file: ~c"/buildroot/deps/cowboy/src/cowboy_http.erl", line: 257]}, {:proc_lib, 
:init_p_do_apply, 3, [file: ~c"proc_lib.erl", line: 241]}]}

It seems the server is attempting to decode the message as a binary, resulting in a function clause error. But I’m unsure why this specific function is being called, since browsing the webpage works fine.

Has anyone experienced a similar issue or have any insights on why this might be happening? Any suggestions or guidance would be greatly appreciated.

Below is the XML configuration I’m using:

<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/share/tsung/tsung-1.0.dtd">

<tsung loglevel="debug" backend="fullstats" dumptraffic="true" version="1.0">


	<!-- Client side setup -->
	<clients>
		<client host="localhost" maxusers="5000"/>
	</clients>

	<!-- Server side setup -->
	<servers>
		<server host="example.io" port="443" type="ssl"/>
	</servers>


	<!-- Adjust injection load -->
	<load>
		<arrivalphase phase="1" duration="1" unit="minute">
			<users arrivalrate="1" unit="minute"></users>
		</arrivalphase>
	</load>

	<options>
		<option name="file_server" id="user" value="gc.csv"/>
		<option name="ports_range" min="1025" max="65535"/>
	</options>

<sessions>

<session name='websocket' probability='100'  type='ts_websocket'>

<transaction name="1_1_Open_Connection">
	<request subst="true">
		<websocket type="connect" path="/live/websocket"></websocket>
	</request>
	<request>
        <websocket type="message">[null,"1","phoenix","heartbeat",{}]</websocket>
    </request>	
</transaction>

</session>

</sessions>

</tsung>

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
bradley
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New
dillonoconnor
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews