yukster
Should I use channels or a regular JSON web endpoint for my react native app?
Pondering the pros and cons of making a JSON web endpoint (controller action) vs using a channel for the backend for a React Native app.
I had been looking into GraphQL, but I think it’s overkill for my app, at least now. It’s going to have have a single user’s data and not a large amount of data that would need to be queried in varying ways. It’s a handful of relations revolving around one main entity and the user will have a list of those. Thoughts regarding the benefits or pros/cons of the two approaches in this context?
One important criteria for the app is to work well with a fickle connection, so that makes me wonder if it’s worth the hassle of using channels. On the other hand, the stakeholder would like “save on blur” type behavior in the forms (I’d love to do it with LiveView, but the stakeholder also wants a “real” mobile app), which would work better with a channel. However, I could also have the client form save-on-blur locally with eventual consistency with the back end.
Most Liked
bottlenecked
From personal experience websockets tend to be lower latency but http is better when observability matters. It is usually easier to trace (logs, metrics) and debug both clientside (chrome dev tools) and server side, as firewalls, reverse proxies and almost every physical or virtual appliance that manages network traffic in some manner is much more capable of logging http request details (layer 7 packet inspection) than websocket traffic. If the server needs to push data to the client though a mixed solution (http for synchronous requests/responses, websockets for server pushed data).
I hope this helps.
yukster
Ha. Helps to carefully read the docs. I was trying to destructuring my state out of an object returned from useChannel instead of an array as the README clearly states. It’s now hooked up and working fine.
I’m surprised there doesn’t seem to be much uptake for that use-phoenix-channel library. It’s not a lot of code, but it’s a nice abstraction and saves a little bit of work. Then again, we’ll see how I feel once I have a lot more data to deal with.
outlog
this is incorrect
the limit is “per router” and they have a lot of routers - you can ask support for the real limits, or do a load test.. last time I checked the limit was around 1500 per dyno in the EU region ymmv..
Popular in Questions
Other popular topics
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
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








