6
I want to create a 'mini server' to use on my site (tumblr), for real communication with my visitors and one way to do this is by using ajax requests. When the site loads, it requests a JSON file, when I receive that file the request is made again and so on. When I update the JSON file, the site receives it almost immediately, then the data will be updated for visitors.
I have doubts about doing this, I don’t know if you can crash the site, get a lot of internet or have some bad effect. You think I can do this or there’s some better way?
This "real communication" of which you comment, would be a kind of chat?
– Kazzkiq
Chat no, more yes a notification on the site, to informative, not exactly a chat.
– Iago Bruno
Let me see if I understand, your idea is that you have for example a message on the site, that when you edit on your server, it in real time appears to anyone who visits the site, correct?
– Kazzkiq
It would not crash the site, it would spend a lot of bandwidth on both sides (client and server), which is bad for those who use limited bandwidth. But if the interval between requests is anything more than 30 seconds, for example, I imagine it’s even acceptable.
– Gustavo Rodrigues
Yes @Kazzkiq, but in case I would update a file on Google Drive even (rsrsrsrsrs).
– Iago Bruno
The problem is that making an ajax request every X seconds is relative to the client, that is, if 500 people enter the site, 500 simultaneous requests would be triggered every X seconds, and in terms of performance this is quite complicated. Your case seems to be typical of problems where the solution would be to use Ajax Polling or Comet.
– Kazzkiq
Ajax pooling is what he is talking about. Comet is the junction of various techniques. In case he would have to use pooling Ajax because he intends to use Google Drive as hosting. However, this would create a problem since a bandwidth expenditure above normal could cause problems regarding the service use limit.
– Gustavo Rodrigues
I would recommend that he use his own notification service or, if he wanted more control, use the Firebase. It uses Websockets, which makes response time minimal and its free version supports up to 50 concurrent users.
– Gustavo Rodrigues
because then, I discovered Firebase a few days ago, I thought of several advantages of using it, but I was disappointed to learn that it only supports 50 users, so I thought of this idea of using ajax.
– Iago Bruno
You want cheap or you want good?
– Gustavo Rodrigues
kkkkkkkkkkkkkkkkkkkkkkkk I want the 2 u.u
– Iago Bruno
When you mentioned that you are using Tumblr and Google Drive we consider that you will not pay for hosting. There are free, limited and efficient accommodations; free, not limited and not efficient; and paid for of all kinds.
– Gustavo Rodrigues
Tumblr, Google Drive and most of the good free accommodations are of the first kind, so even if you use one
$.ajax
loading a file something may go wrong. I know some accommodation of the second type, but I do not recommend it. The third kind do not know for I am poor.– Gustavo Rodrigues
kkkkkk because then, I have no money to be using these things, so I thought to use them themselves =P. But it is a good or not to use this method? There’s another service you recommend?
– Iago Bruno