Packard_Goose
Issue with Websockex and json encoding
I’m trying to send a message using websockex but I’m getting an error when I try to send out my json string (I used Jason), what could I possibly be missing?
"{\"action\":\"subscribe\",\"options\":{\"accounts\":[\"nano_1qzfp3op48im348qdybmrheu9dogtopj1jyioguq9pyo5i7mkqgo4jaswp4a\"],\"all_local_accounts\":true},\"topic\":\"confirmation\"}"
** (ArgumentError) argument error
:erlang.send(MitoNode.Client, {:"$websockex_cast", "{\"action\":\"subscribe\",\"options\":{\"accounts\":[\"nano_1qzfp3op48im348qdybmrheu9dogtopj1jyioguq9pyo5i7mkqgo4jaswp4a\"],\"all_local_accounts\":true},\"topic\":\"confirmation\"}"})
(websockex) lib/websockex/utils.ex:57: WebSockex.Utils.send/2
(websockex) lib/websockex.ex:398: WebSockex.cast/2
Marked As Solved
NobbZ
That just delegates the start of the client to its start_link/1, IIRC.
But in that, do you actually name the started process?
1
Last Post!
CamonZ
You can also use the pid of the WebSockex process and WebSockex.send_frame/2 to send the data. e.g.
{:ok, pid} = MyWebSockexWrapper.start_link()
msg = Jason.encode!(%{
"action" => "subscribe",
"topic" => "confirmation",
"options" => %{
"all_local_accounts" => true,
"accounts" => [
"nano_1qzfp3op48im348qdybmrheu9dogtopj1jyioguq9pyo5i7mkqgo4jaswp4a"
]
})
WebSockex.send_frame(pid, {:text, msg})
0
Popular in Questions
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
Hi there,
I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
lets say i have a sample like
a = 20; b = 10;
if (a > b) do
{:ok, "a"}
end
if (a < b) do
{:ok, b}
end
if (a == b) do
{:ok, "equa...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Hi everyone,
I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
Other popular topics
Hello, how can I check the Phoenix version ?
Thanks !
New
Hi guys, i’m new in the Elixir world, and i have to say, that i love it!
i’m having some problem to understand anonymous functions with ...
New
If I have a post route which an argument:
post /my_post_route/:my_param1, MyController.my_post_handler
How would get the post params ...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









