inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Dec 13, 2013 13:22:23 GMT -8
It seems whenever I try to share information in a forum key that the .get() function will not get information recently saved to the key by another user UNTIL the current page is refreshed. Does anyone have any tips on how to share information in a real-time scenario?
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,023
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Dec 13, 2013 14:25:24 GMT -8
It seems whenever I try to share information in a forum key that the .get() function will not get information recently saved to the key by another user UNTIL the current page is refreshed. Does anyone have any tips on how to share information in a real-time scenario? The .get() method initiates no communication request but instead returns the data that was initially sent with the page load. However, if there are other AJAX requests initiated during the lifespan of that page then the returned payload will also include updated data which .get() can then use on subsequent calls. To clarify, if someone likes a post, view who replied to a thread or otherwise perform any action that generates an AJAX request (including setting a key value I believe[??]) then in addition to the returned response updating number of likes, involved members, etc it would also update the key data. This would then reflect any changes that occurred between initial page load and the time that AJAX request was made. You may then reach the conclusion that you would first need to generate an AJAX request before doing a key read in order to get the most up-to-date data but remember that programmatically generating any AJAX [edit: to Proboards' servers] other than requests relating to key data is forbidden and even then frivolous request such as those (just to get updated data) could be viewed as abuse of valuable network resources. Some sort of throttling coupled maybe with a flag for time-sensitive gets (thus generating real-time AJAX get requests) could be a solution for protecting this precious resource but until such time this problem might just remain.
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Dec 13, 2013 17:23:13 GMT -8
It seems whenever I try to share information in a forum key that the .get() function will not get information recently saved to the key by another user UNTIL the current page is refreshed. Does anyone have any tips on how to share information in a real-time scenario? The .get() method initiates no communication request but instead returns the data that was initially sent with the page load. However, if there are other AJAX requests initiated during the lifespan of that page then the returned payload will also include updated data which .get() can then use on subsequent calls. To clarify, if someone likes a post, view who replied to a thread or otherwise perform any action that generates an AJAX request (including setting a key value I believe[??]) then in addition to the returned response updating number of likes, involved members, etc it would also update the key data. This would then reflect any changes that occurred between initial page load and the time that AJAX request was made. You may then reach the conclusion that you would first need to generate an AJAX request before doing a key read in order to get the most up-to-date data but remember that programmatically generating any AJAX [edit: to Proboards' servers] other than requests relating to key data is forbidden and even then frivolous request such as those (just to get updated data) could be viewed as abuse of valuable network resources. Some sort of throttling coupled maybe with a flag for time-sensitive gets (thus generating real-time AJAX get requests) could be a solution for protecting this precious resource but until such time this problem might just remain. Thank you so much. I was wondering if there had been a call I was missing. That puts a big cloud over my parade. (I'm designing an interactive shop that users can add and remove posts, i require an updated version for people who do multiple things in the span of 5 minutes such as make 5 postings. When another user with an un-updated page then adds something, the original users data is completely lost. Which is a bummer because thats the whole idea of having a Forum Key.) However since that is true, when the user hits the button that requires such updated calls I could just save the data to sessionStorage, then refresh, then when the page loads set the key. However that is against policy to set the key on onload. But since the user originally pushed a button would it be acceptable? Because If I have to make a confirm popup that will stop the flow of setting the key immediately, I still have the original problem of not having "current" data. And now the data is as old as the time it takes to click that button. Or even maybe write it on onload and create a popup box that will allow them to revert changes if they changed their mind? Cause I know iframes are out of the question as well as ajax.
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,023
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Dec 13, 2013 19:05:18 GMT -8
Thank you so much. I was wondering if there had been a call I was missing. That puts a big cloud over my parade. (I'm designing an interactive shop that users can add and remove posts, i require an updated version for people who do multiple things in the span of 5 minutes such as make 5 postings. When another user with an un-updated page then adds something, the original users data is completely lost. Which is a bummer because thats the whole idea of having a Forum Key.) However since that is true, when the user hits the button that requires such updated calls I could just save the data to sessionStorage, then refresh, then when the page loads set the key. However that is against policy to set the key on onload. But since the user originally pushed a button would it be acceptable? Because If I have to make a confirm popup that will stop the flow of setting the key immediately, I still have the original problem of not having "current" data. And now the data is as old as the time it takes to click that button. Or even maybe write it on onload and create a popup box that will allow them to revert changes if they changed their mind? Cause I know iframes are out of the question as well as ajax. Tim Camara would most likely need to confirm this but the newer key set methods such as append, prepend, push, etc. were added after a discussion about the very problem you describe (data contention). I personally haven't tried these newer key manipulation methods yet but I would suggest you try them since they were designed to guard against that key overwrite problem. I however remain somewhat dubious regarding real-time apps since the choice of the data being set usually depend on the accuracy of the data that is presented. As an example, if a user was bidding on an item then whatever they chose to bid would depend heavily on the highest bid posted so far. If the highest bid presented at page load was $10 but 2 seconds later a bid came in for $13 the decision to set a bid of $12 by the user would be erroneously based on that $10 figure rather than the updated figure. On page reload it would be apparent that the bid was now invalid so saving locally then setting on reload would not necessarily solve the problem. As noted earlier you could setup a listener for AJAX communication (e.g ajaxComplete) which would then notify you of the potential for updated results being available should the user perform any action that resulted in an AJAX request and allow you to update the display (from $10 to $13 in the example) without actually refreshing the page. I'm not privy to how you've created the inventory presentation for this shop but if it is on a thread view page for example then you could conceivably rename the like button to "update" since it generates an AJAX request each time it is clicked to like/unlike with the benefit of also updating the stale key data. The other option I hinted at would be to set some bogus key perhaps at some preset interval then check for updated values, sort of a polling solution, this however would probably not go over well with management (aggravated resource assault). I'll also mention that the API provides a non-modal confirm dialog which would not stop the flow as you put it and is preferable to the modal browser version since it allows scripts running in the background or on a timer to continue unimpeded (the date/time updater for example).
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Dec 13, 2013 20:54:31 GMT -8
I tried push previously to the topic. But it was designed for adding data to userkeys on offline users without destroying data. It has no additional effects for forum keys. Unless say I use pop to retrieve all the key's data, granted it must perform an ajax request that updates the keys which I don't believe it does. I do have it set with the confirm box supplied by javascript. The like button idea is a good one, however my app is designed off of the profile page. And disguising and using a like button as such would most likely be abusing it's purpose. Your bidding scenario is to the point, however I understand that having an error rate is necessary, and of around 1-2 seconds would be suitable for my needs. The odds of an overlapping occurrence in that short amount of time, right now, is very slim. It's 5 seconds and up that worries me. Your very wise and I'm glad that you've spent the time to offer logical and simple solutions to my problems including ones that I did not deliberately mention. Perhaps Tim Camara, you would have a comment on the subject and our brainstorming, and possible enlightenment on the available functions for retrieving updated data?
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Dec 15, 2013 22:51:30 GMT -8
Well currently I have the plugin.set data sent as pure text to a popup (href=http://nuevopokemonleague.freeforums.net/user) that then runs in the popup (via: innerHTML) and closes itself after it is saved and the parent window detects that and then refreshes itself. Initiated by a button click. I am assuming that is acceptable...enough.
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,023
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Dec 16, 2013 16:51:30 GMT -8
As long as the sequence of events is set in motion by user action then I personally see no problem with it! That is a pretty creative way to get it done but a word of caution regarding the key set request since depending on how many other plugins might be setting a key value alongside yours, Proboards will cache the requests instead of sending it immediately and that coupled with the possibility of high latency/congested network could make that value you've used in setTimeout inadequate. A more dependable method might be to use the success callback routine of the key set call itself in order to continue with the next step in the sequence of actions. Also by using the error callback you can head off any unforeseen situations and keep your user informed or at the very least don't have them think a transaction went through when it actually failed.
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Dec 16, 2013 22:54:22 GMT -8
Thank you for that. I totally forgot the key had an error option. There is so many checks that I have been doubling up on, once on the app and once on the popup to make sure that each value is still correct. I've been working on it for about two and a half weeks and it is soooo close. Now I just need to make a quantity button, add that error call you suggested, and have the popup check if the product still exists. I hope to get it done by tomorrow night. I am eternally grateful for your time and your input. No doubt I would still be at a standstill today if it wasn't for your insight. When I first thought of a forum key, I thought "wow" that should be the answer to all my problems. Alas, the forum key isn't even user friendly. It kind of defeats the whole idea of sharing data in my opinion if one user with an unrefreshed page can overwrite the whole key with stale data no matter if you use append, push, or set.
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,023
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Dec 18, 2013 17:15:05 GMT -8
I'll probably need to take a closer look at the push/pop key calls then because from the given name I gathered it push new data onto the stack (an array you initially create on first key set) thus avoid disturbing data that may have been submitted prior. I envisioned it as then a simple matter of filtering the values based on whichever criteria that data demand. If it was time-based (first come, first serve) for example, then the earliest index would win. If it was magnitude-based (e.g. highest bid) then it would be a matter of determining the largest (or smallest) number in the array. The append/prepend would be in a similar vein but using string manipulation rather than arrays, is this not how you had it implemented?
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Dec 19, 2013 1:38:53 GMT -8
Well I tried push and pop again and It seemed to work. I assume I was doing something wrong the first time. However It still doesn't get updated values. Which is at least less of a problem at least it won't overwrite my data.
|
|