Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

server-sent event in HTML5

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    server-sent event in HTML5

    In my shopping cart I tell the user how many "Apples" are available but this is found at the time they request an "Apple".
    I realise I could do a call back at a regular interval to update this value but that will put extra load on the server.
    I would like the server to refresh the page if an "Apple" is sold.

    There is a server-sent event in HTML5 to help with this.

    I would like to use code similar to this ASP block

    <%
    Response.ContentType = "text/event-stream"
    Response.Expires = -1
    Response.Write("data: " & now())
    Response.Flush()
    %>

    Does anyone know how I would do this?

    Michael

    #2
    Re: server-sent event in HTML5

    Is it your shopping cart... iow... did you build it? Is it an a5w page... a grid... a ux?

    You write...

    There is a server-sent event in HTML5 to help with this.

    Do you mean... Is there a server-sent event in HTML5 to help with this?

    When you sell an Apple... how about performing your ajax callback at that point to go and get the number of apples.

    The code you reference, in Alpha terms, looks like it would be an a5w page containing a query string and just prints data out to the display.

    I would think at the time you sell the apple you'd perform an ajax callback, get the number of apples and update something on whatever your cart is.

    Need a bit more info.

    Comment


      #3
      Re: server-sent event in HTML5

      The shopping card works on a number of levels. Yes in the most practical way it is built.

      I need to do 2 things the first is to save it to local storage so that I can let the user navigate away from the page/website and still hold their choices.
      The second thing is to report to the user the current stock of "Apples".

      I am trying to do as little on the server as possible. As you probably remember this is a Bagel delivery website and we expect it to be very busy at peak times. The estimated figures from Alpha on a single Server capacity seems to be at our predicted use level.

      The code I posted is ASP.

      I read about http://www.w3schools.com/html/html5_...sentevents.asp

      This looks like it will reduce the server load. I was wondering if anyone had used it will Alpha.

      My problem is not the main process when it occurs at a fast pace but rather a person who logs on and then does not save the shopping cart immediately.
      I want to update the current stock levels without too much server load.
      Forcing the user to refresh is not very elegant.

      Michael

      Comment


        #4
        Re: server-sent event in HTML5

        HTML5 localstorage will look after your local storage needs.

        To me it looks like setting up SSE is just another layer of complexity that's not going to do much for you. First... can the Alpha server do it? Second, not support by IE which I could give 2 crackers about because even if they did support it they'd probably mess it up. Third, it seems as if SSE keeps a connection open... or at least tries to. Fourth... you're still running something on the server... it's still a server load... maybe less... but is it worth the hassle? Fifth... even with SSE your stock levels may still be out of date, depending on how often your SSE runs.

        If you want real stock levels, or as close as you can get, I'd just go get my apple count when the apple is selected... and again at checkout. That's two calls as opposed to how many times the SSE will run in a loop on the server. You don't have to make the user refresh. They're performing an action anyway that you piggyback on.

        If the user picks a apple and walks away from their cart for an hour, comes back and your SSE has updated the apple to out of stock... then great... no apples.
        If they come back and click check out and then find out there are no more apples I don't see the difference. Except 2 callbacks compared to a lot more SSE.

        How often would you have the SSE running?

        Comment


          #5
          Re: server-sent event in HTML5

          OK

          The logic seems good.
          I am like a kid in a smarty (Similar to M&M's) shop see something new and want to try it.

          What happened to Markham or where ever?

          Michael

          Comment


            #6
            Re: server-sent event in HTML5

            I think Smarties were around long be M&Ms... althought I prefer the peanut M&Ms, I was pretty much raised on Smarties.
            Markham is still here... incorporated as a City a few years ago and becoming more stupid, just like a city, every day. The mayor and his cronies are selling every single piece of green space for development.
            Unionville is actually an historic village within Markham (well... as historic as Canada can get, although it does date back to the late 1700's) and it's somewhat protected from political greed and downright dumbness.

            Still... it would be interesting to find out how, if possible, to get an SSE to run from Alpha, and to run some tests.

            Comment


              #7
              Re: server-sent event in HTML5

              I read most of the previous post thinking it was related to the original question!

              I am sure this is said below, you use an Ajax callback to update the quantity in the database at the appropriate time during the sale, and then an Ajax callback to get the quantity when needed, and then (to avoid the browser refresh) javascript to update the browser to show the new quantity when needed.

              As an example go to my Store at http://alphatogo.com/products.a5w. Click Add to Cart for the first item. It pops up a message, click OK on the message. As soon as you click OK, a message appears on the screen detailing what has just been purchased. (Note - the popup message is not important, it does not affect the rest of this example). If you continue to add items to the cart, the information in that box is updated. And notice in the far upper right, the Cart values continue to increment up as you add items. None of that required a browser refresh.

              Now, if so inclined, click Check out and buy something
              Steve Wood
              See my profile on IADN

              Comment


                #8
                Re: server-sent event in HTML5

                OK

                Thanks David and Steve, I will stick to the solid and tested. I already do a call back each time I add an item to the cart; I do this to check the product is still available.
                I will wait until the validate before save to do a final browser check.

                Michael

                Comment

                Working...
                X