Hi Andrew, I would set up some javascript that would make an ajax call every 5, 10, 30 seconds (whatever interval works for you) and then would update the orders on the page if any new ones had come in.
I think that would be much easier to set up than trying to make things literally real time. Even websockets will have latency so nothing is truly real time, just an approximation. The question is how good of an approximation you need to have. To make this more efficient you could have your javascript store the most recent order number, then on whatever interval you decide it makes a call that only checks what the most recent order number is in the database. If it has changed from what you had stored you then make a separate call that reloads the orders (or just loads the newest ones). On Wed, May 13, 2015 at 8:03 PM, Andrew Fam <[email protected]> wrote: > Hey Stephen thanks for this. > > Yes I understand AJAX and a real time update. > > The store I"m working with sells quite fast moving products and needed a > consolidated orders view that would be automatically updated once orders > came in. > So, instead of having to click refresh the page to see the new orders, I > was looking for a way for the page to update once a new order came in. > > Best regards, > Andrew > > > On Sunday, May 10, 2015 at 7:03:58 AM UTC+8, Stephen McDonald wrote: >> >> Hi there, >> >> "real time" is incredibly vague and begs for a stricter definition. The >> true meaning indicates a guaranteed response time, which is most likely not >> what your client means (http://en.wikipedia.org/wiki/Real-time_computing >> ). >> >> What they most likely mean is "submits without reloading the page", in >> which case, rather than introducing a whole separate moving part into your >> stack (a websocket server), along with what appears to be another >> framework, you could achieve the desired result simply by making an AJAX >> request in the checkout process. >> >> If unfortunately your client actually means "has to use websockets", then >> you might be able monkey-patch the relevant model doing something like: >> >> Foo.__bases__ = (SelfPublishModel,) + Foo.__bases__ >> >> But before you go down that path I think you'd do yourself and your >> client a favour by educating them on using the best tool for the job rather >> than having them dictate your architecture to you :-) >> >> Good luck! >> >> >> >> On Sat, May 9, 2015 at 2:57 PM, Andrew Fam <[email protected]> wrote: >> >>> I'm thinking of using mezzanine but a client wants a real time update of >>> orders. >>> >>> http://swampdragon.net/documentation/quick-start/ >>> >>> from django.db import modelsfrom swampdragon.models import >>> SelfPublishModelfrom .serializers import FooSerializer >>> >>> class Foo(SelfPublishModel, models.Model): >>> serializer_class = FooSerializer >>> text = models.CharField(max_length=100) >>> >>> >>> Got this off the swampdragon page and they require an addition of >>> SelfPublishModel to any object that you need realtime support. >>> Any idea how to do this with cartridge? >>> >>> >>> Best regarsd, >>> Andrew >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Mezzanine Users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Stephen McDonald >> http://jupo.org >> > -- > You received this message because you are subscribed to the Google Groups > "Mezzanine Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
