Access webapp that uses websockets - websocket

I'm totally new to the websocket world. I'm using Atmosphere to implement websockets in my Angular webapp and I have only been able to create a partial solution. When a user focuses on an input text element the others users see that input is disabled, and when the user's focus leaves the input text element the other users see the new content.
But what if one user accessed the webapp and another one was already focused on the input text element. How can I detect this? Is still possible with atmosphere/websocket or I need to implement another kind of strategy?

Related

Can I use recaptcha v3 to verify click traffic?

I have a website where people can interact with different objects to view specific content. I would like to know which objects get the most interactions by real people. For example there are thumbnails of images and I would like to know when a user clicks on a thumbnail to view an image.
To do this I thought I would create a psql table with thumbnail_id and an IP address, where every single view is stored (to ensure every combination of thumbnail and ip is only counted once and people can't just spam click it).
And so every time a click happens, a post request on a /views endpoint with the thumbnail id attached is made in the background.
The proplem is, some people may be incentivized to create bots to auto click certain images with many different IPs.
So I was wondering if I could use recaptcha v3 to identify real users as opposed to bots which would include a token with every view request.
But I was wondering, would is this too much for my backend to handle (since it would have to talk to googles servers every time anybody views an image, which might be every few seconds for each user and I would be billed while the server waits for a response) or be too expensive, since I have to pay google on every request? Or is there some other obvious problem with this?
I'm asking since I have only ever found recaptcha used for single form validation and never for traffic measurements, even though that seems like a pretty obvious use case.

What architecture is best for multiple users editing the same database record?

I have a Django REST Application that has POST and GET endpoints for a record in database. It allows multiple users to POST data to it and GET from it. I can implement locking to make sure the records don't get overwritten and I can make sure the front-end pulls latest record first before users starts to write.
The problem comes when two users are editing the same thing simultaneously, I am looking for a solution as robust as Miro or Google Docs, where you can see the name of the user editing a line while you are also editing the same line.
Currently, its a simple Django REST app but is there anything out there that can help me make it more like Google Doc editing, as robust and truly realtime as it?
How are they managing such a thing in their architecture? What am I missing here?

Slack App - Is it possible to customize blocks depending on users?

I'm working on a Slack App and I would like to customize some messages depending on the users who view them.
I know about chat.postEphemeral API method, but the visual rendering is not at all pleasant (at least for my app layout).
The best solution would be to add some blocks which can be viewed/customized depending on the users who view them. Is there some way to do that?
Edit:
After several researches I did a new feature proposal to enrich the messages to Slack to have something potentially new which can be helpful to someone else. Everybody is welcome to the discussion to improve the proposal.
I'm afraid not. When you're posting messages into a conversation using chat.postMessage, the content of that message is the same for all users.
You've a few options, but they really depend on your app's flow.
Use chat.postEphemeral, as you've mentioned already
Render a modal view, which gives you the User ID before you construct the view, allowing you to customise it. The downside here is that it will require some user interaction like clicking a button before you can present the modal.
Render the content inside an App Home, which again will provide user ID, but this exists outside the context of a conversation, which might be important for your app.
Other than that, I'm afraid you'll need to stick with a generic message.

getStream - Flat Feed where multiple users can post

we are implementing stream in our application and so far we love the out of the box react components as well as the backend implementation stream ruby - this is our setup currently.
We are close to deploying a first MVP but found that it seems to be not possible to post activities to a flat feed from multiple users by default.
Our use case is that we have a group of people that want to post activities about a certain topic (think facebook groups). Therefore we create a feed for the object (lets say a company) and want each user to be able to post activities there. Our current workaround is to add the author id as additional data and add a custom header to a activity - obviously not the best solution as reactions won't work that way.
Looking around we found that this seems to not work out of the box see this issue and this question.
Is this a feature that is only available to paying customers or how can we activate it?
Thank you in advance!
When using Stream with React users can only post to their own user feed, this is a default permission policy that can be changed by Stream.
I suggest reaching to Stream support by email and ask to change the permission policy.

Parse.com data migration [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am developing an application that needs a backend, so I choose parse because I do not have the capacity to write a truly great backend myself.
Now I want to migrate my data from parse to my own system, because parse.com is owned by facebook (privacy concerns, etc), and because it is shutting down. Does parse provide a way to efficiently do that?
EDIT
Parse announces Shutdown of Services.
Best practices and options for migrating from Parse to ? AWS, or other system, vs creating new backend based on parse.com code.
This shouldn't be difficult at all if your own backend can handle an upload of a JSON file.
Parse allows you export your data in a JSON formatted file.
All you have to do is go to the "Settings" tab in your Parse Dashboard - then click the "Export Data" tab. This will then give you a URL for you to retrieve the .zip of this JSON file.
You will then just have to import your data to your new backend.
If you move your data from Parse to another location i.e. Mongo or another PaaS provider, you will still need to update the client code. If you have a mobile app, and your end users don't bother to update their app, then how do they connect to the new datasource (DB)?
You would need to build this migrate functionality into your client from the 1st public version to be sure to capture all users, so you can flip the switch. That's a lot of work, you have to write your own wrapper for the Parse API or REST calls.
If your app is serving HTML from the server i.e. a PhoneGap app, with server side page rendering, then you are de-coupled from the app executable on the end users phone/tablet. MeteorJS has hot code push to solve this.
But trying to migrate data without having a plan in place from the get go is pretty much horrible. You could send a notification to all the old clients that need to update their mobile app, telling them to update, and shutting down the Parse backend, but that's not a great user experience. If they don't have notifications turned ON... You could code an alert/msg to popup based on you populating a field in the parse DB, poll to check it every few mins. Still not smooth.
You mobile client code would need to updated accordingly. I wrote up a part 1 of a blog on these considerations for migrating over from Parse to Couchbase Mobile stack and the reasons why.
Overall there will be some work to do as you would need to either copy over the entire datebase and then let the user to update their client app when appropriate to attach to the new backend. Getting everyone on the new system is required now as Parse is shutting down so a consideration is to create a requirement product feature with a new version number for upgrade.

Resources