Results 1 to 2 of 2

Threaded View

  1. #1

    Exclamation HTTPS and Flex API

    Solved. My port was wrong. I should have been using 443

    Hi,

    Has the Flex API been depreciated or is it still supported? I notice there's not been much activity on this part of the forum recently.

    I am using Lightstreamer with the new IGIndex API. I am as sure as I can be that I'm using the right login and endpoint but I can't get this to work. I have posted a message on the IGIndex forums to make sure I've got everything right - https://labs.ig.com/node/56.

    Interestingly, if I use getDemoConnectionInfo() instead of getConnectionInfo(), i.e. the connection info in your examples, it works as expected. Is there possibly a problem with a secure https connection?

    My class follows. All I see in my console is:
    onStatusChange CONNECTING
    onStatusChange DISCONNECTED
    onStatusChange CONNECTING
    etc...

    Code:
    package controllers 
    {
        import com.lightstreamer.as_client.*;
        import com.lightstreamer.as_client.events.*;
        import flash.utils.*;
        import models.*;
        /**
         * ...
         * @author Tim
         */
        public class StreamerClient extends LSClient
        {
            private static var alreadyConstructed:Boolean = false    
            
            public function StreamerClient(endpoint:String, clientId:String)
            {            
                super()
                
                if (alreadyConstructed)
                {
                    throw new Error("Only one instance of Lightstreamer allowed. Access it through models.Streamer")
                }            
                alreadyConstructed = true
                
                addClientListeners()
                
                var connectionInfo:ConnectionInfo = getConnectionInfo(endpoint, clientId)
                openConnection(connectionInfo)
                
            }
            
            private function addClientListeners():void
            {
                addEventListener(StatusChangeEvent.STATUS_CHANGE, onStatusChange);
                addEventListener(ServerErrorEvent.SERVER_ERROR, onServerError);
                addEventListener(ConnectionDropEvent.CONNECTION_DROP, onConnectionDrop);
                addEventListener(ControlConnectionErrorEvent.CONTROL_CONNECTION_ERROR, onControlConnectionError);
            }
            
            private function getDemoConnectionInfo(endpoint:String, clientId:String):ConnectionInfo
            {
                var connectionInfo:ConnectionInfo = new ConnectionInfo()
                connectionInfo.server = "push.lightstreamer.com"
                connectionInfo.controlProtocol = "http"
                connectionInfo.protocol = "http"
                connectionInfo.port = 80
                connectionInfo.controlPort = 80
                connectionInfo.adapterSet = "DEMO"
                return connectionInfo
            }
            
            private function getConnectionInfo(endpoint:String, clientId:String):ConnectionInfo
            {
                var connectionInfo:ConnectionInfo = new ConnectionInfo()
                connectionInfo.password = "CST-" + CST + "|XST-" + X_SECURITY_TOKEN
                connectionInfo.user = clientId
                connectionInfo.server = endpoint.substr(8) //Strips https:// from the front of the string
                connectionInfo.controlProtocol = "https"
                connectionInfo.protocol = "https"
                connectionInfo.port = 80
                connectionInfo.controlPort = 80
                connectionInfo.adapterSet = "DEFAULT"
                return connectionInfo
            }
            
            private function onStatusChange(event:StatusChangeEvent):void
            {
                trace("onStatusChange", event.status)
            }
            
            private function onServerError(event:ServerErrorEvent):void
            {
                trace("onServerError")
            }
            
            private function onConnectionDrop(event:ConnectionDropEvent):void
            {
                trace("onConnectionDrop")
            }
            
            private function onControlConnectionError(event:ControlConnectionErrorEvent):void
            {
                trace("onControlConnectionError")
            }
            
        }
    
    
    }
    Last edited by TimL; October 2nd, 2014 at 10:15 PM.

 

 

Similar Threads

  1. Replies: 1
    Last Post: March 25th, 2010, 10:04 AM
  2. cross domain between http and https
    By riwang in forum Client SDKs
    Replies: 1
    Last Post: January 7th, 2009, 11:56 AM
  3. HTTPS & Flex Client
    By venkihere in forum Client SDKs
    Replies: 13
    Last Post: October 22nd, 2007, 06:01 PM
  4. Flex Client API now generally available
    By Alessandro in forum Client SDKs
    Replies: 0
    Last Post: September 3rd, 2007, 05:23 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 12:36 AM.