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

Web-Socket Messaging User specific? Who's played with this?

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

    Web-Socket Messaging User specific? Who's played with this?

    The new Web-Socket messaging looks like it's just the ticket for what I was trying to accomplish with a setinterval query (that uses a lot of resources). However, I think it's missing something, or I'm missing something. What about "private" messaging? I need to be able to send a message from an application to a specific user. Is there something built in to the new functionality to do that or does someone have a good idea of how to do it with code? I'm just looking for the best way to do this.

    Ultimately what I'm after is a way for my application to notify users to view their notifications (that will be kept in a table). This will be used as part of a workflow process instead of emailing as some users don't have email. So, for example, I have an application that assigns a user to a task. This application would update it's bound table and then update a notification table. I want the application then to send a message using Web-Socket to that specific user so if they are online, they'll get a real-time message to check their notifications.

    What I was working on before was having everyone's client check the notifications table at a set interval to see if there was anything new for that user. As it says in Alpha's description for using web-sockets, it's not scalable and takes too many resources.

    #2
    Re: Web-Socket Messaging User specific? Who's played with this?

    Oooooooh.....this is pretty awesome. I've got some of this working and so far so good. I think I like it.

    I added a from and to, to the message object (this is what I wasn't sure would work).
    Code:
    var obj = {type: 'notification', from: _from, to: _to, messageText: _message, command: 'post'}
    That allows check against usernames. This should also allow for private messaging/chatting if I decide to implement that in the future.

    Then I made my listening component check for all message types and then put in a check that if the message type is 'notification' and the 'to' is equal to the current logged in user it will alert that user with the message but won't alert anyone else.
    Code:
    if(typeof e.message != 'undefined') { 
    	
    	
    	//e.message is an object containing the JSON.parse() version of the message that was received
    	var p = e.message;
    	var messageType = p.type;
    	var to = p.to;
    	var from = p.from;
    	var cuser = {grid.Object}.getSessionVariable('CURRENTUSER');
    	
    	if(typeof messageType == 'undefined') { 
    		alert('Received a message, but the type was not specfied.');
    	} else {
    		messageType = messageType.toLowerCase();
    		if(messageType == 'notification' && cuser == to) { 
    			alert(to+'\n'+e.message.messageText+'');
    		} else if(messageType == 'simple') { 
    			alert('Received a simple message: ' + e.message.messageText);
    		} else { 
    			//alert('Received a message: ' + e.message.messageText + ' but there is no special handler for messages of type: ' + messageType);
    		}
    	}
    }
    I can also use this to broadcast application wide admin messages to make sure users save their work when I'm messing with stuff...etc.

    Like I said, so far so good. This seems to be extremely useful!

    Comment


      #3
      Re: Web-Socket Messaging User specific? Who's played with this?

      Dan Hooley did a lot of work with this and it is cool. But we ran into a roadblock because nobody could figure out how to make it work if you used a load balancer. I know Alpha's added some features more recently and there's specific reference to in the release notes about this. We're waiting just a bit to upgrade our site and be able to test this, but if you or anyone else gets experience, a note posted here would be very welcome.
      Last edited by Steve Workings; 04-14-2016, 05:25 PM.
      -Steve
      sigpic

      Comment


        #4
        Re: Web-Socket Messaging User specific? Who's played with this?

        Well, we're three months down the road from this last thread activity, and still can't get the web-socket to work with a load balancer. Has anyone succeeded?

        Zebrahost has been most generous in their help to get this to work, including lots of time with us, lots of time with Alpha, even implementing a new load balancer they'd never used before in hopes of providing a more appropriate set of features.

        Alpha says they've delivered the web-socket with functionality as promised. I understand Alpha's position, which includes:
        "web sockets are complicated and as a result we have made a decision that for individual customers who can't get their particular setup to function we can only provide paid consulting help"

        But the consulting cost is quite high and doesn't imply any guarantee or cost cap -- too much for us to try in hopes of success.

        We've spent months and too much money trying to make this work -- I sure would like to hear from anyone who has figured this out. Any knowledge we can gain here would, I think, benefit many people in the future.

        Thanks.
        -Steve
        sigpic

        Comment


          #5
          Re: Web-Socket Messaging User specific? Who's played with this?

          So if you are saying you have done as advertised and it does not work - namely 'just allow the incoming traffic to pass through to the Node.js server' then you should ask for clarification, we invested in AA to do a redis set up and it was well worth it.

          Using the Web-Sockets Server when Alpha Anywhere is Using a Load Balancer
          A load balancer is commonly used to distribute incoming requests to one of several Alpha Anywhere Application Server instances running on a single Windows computer. Alpha Anywhere uses a Node.js server running on a different port in order to provide WebSockets functionality, so the load balancer will need additional configuration if you will be using WebSockets with your application. The URL used for your application points to the load balancer so it must know about all incoming traffic that is to be expected and passed along.

          Configuring the load balancer to work with the WebSockets server is simpler than configuring it to work with the Alpha Anywhere Application Server instances because only one Node.js server is used. There is no balancing to be done, just allow the incoming traffic to pass through to the Node.js server. The load balancer should be configured to accept traffic on the port that has been specified in the web project properties and send that traffic to the same machine as the Alpha Anywhere Application Servers, but on the port specified. The exact configuration steps vary from load balancer to load balancer, but it is essentially the same as creating the alpha Anywhere Application Server load balancing that was already done but with just a single target.

          Peter
          Insanity: doing the same thing over and over again and expecting different results.
          Albert Einstein, (attributed)
          US (German-born) physicist (1879 - 1955)

          Comment


            #6
            Re: Web-Socket Messaging User specific? Who's played with this?

            How many physical boxes are you using here Pete? We're doing exactly as you quote here, and can get it working just fine with one physical server, but go to two or more and nobody knows how to make it work.
            -Steve
            sigpic

            Comment


              #7
              Re: Web-Socket Messaging User specific? Who's played with this?

              Apologies for a semi-hijack but has an example of capturing the socket messages from a UX/grid to a db table been made available? As in what is the sequence/code/code location (send_message/insert_record vs insert_record/send_message)? Seems like any business-related messaging system would want an archive of communications.

              Comment


                #8
                Re: Web-Socket Messaging User specific? Who's played with this?

                I'd like to bump this back to the top in case someone who has a solution didn't see it before. Is nobody running websocket with a load balancer across more than one physical machine? Or, maybe others have tried it and had the same results we did - can't make it work.
                -Steve
                sigpic

                Comment


                  #9
                  Re: Web-Socket Messaging User specific? Who's played with this?

                  Originally posted by menehune View Post
                  Apologies for a semi-hijack but has an example of capturing the socket messages from a UX/grid to a db table been made available? As in what is the sequence/code/code location (send_message/insert_record vs insert_record/send_message)? Seems like any business-related messaging system would want an archive of communications.
                  Sure,
                  Once you've captured the message with JavaScript, it's quite simple to use an Ajax Callback to some server-side Xbasic to CRUD on a db. The reverse is also true, just return JavaScript from the Xbasic function to send a message.. In my application, I'm saving the messages to a notification table and then a notification history table once a user takes an action on them.

                  Comment

                  Working...
                  X