ICEmobile
  1. ICEmobile
  2. MOBI-916

Support ICEpush within BridgeIt JavaScript API

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE 1.3
    • Fix Version/s: BridgeIt 1.0
    • Component/s: Core
    • Labels:
      None
    • Environment:
      ICEpush, BridgeIt

      Description

      A simplified BridgeIt API should allow JavaScript developers to use ICEpush as a service.

        Activity

        Ted Goddard created issue -
        Ken Fyten made changes -
        Field Original Value New Value
        Assignee Steve Maryka [ steve.maryka ] Mircea Toma [ mircea.toma ]
        Ken Fyten made changes -
        Assignee Mircea Toma [ mircea.toma ] Steve Maryka [ steve.maryka ]
        Ted Goddard made changes -
        Assignee Steve Maryka [ steve.maryka ] Ted Goddard [ ted.goddard ]
        Hide
        Ted Goddard added a comment -

        Currently two configuration lines are necessary to initiate ICEpush as a service

        <script type="text/javascript" src="http://labs.icesoft.com/push/code.icepush"></script>

        <script type="text/javascript">
        ice.push.configuration.contextPath = "http://labs.icesoft.com/push/";
        </script>

        This can be reduced to a single bridgeit configuration of "http://labs.icesoft.com/push/".

        Show
        Ted Goddard added a comment - Currently two configuration lines are necessary to initiate ICEpush as a service <script type="text/javascript" src="http://labs.icesoft.com/push/code.icepush"></script> <script type="text/javascript"> ice.push.configuration.contextPath = "http://labs.icesoft.com/push/"; </script> This can be reduced to a single bridgeit configuration of "http://labs.icesoft.com/push/".
        Hide
        Ted Goddard added a comment -

        bridgeit.usePushService("http://labs.icesoft.com/push/", apiKey)

        Show
        Ted Goddard added a comment - bridgeit.usePushService("http://labs.icesoft.com/push/", apiKey)
        Hide
        Ted Goddard added a comment -

        The essential features from ICEpush are covered by: createPushId, addGroupMember, register, resumeConnection*, pauseConnection*. not called by application, will be integrated with bridgeit.js or code.icepush.

        Show
        Ted Goddard added a comment - The essential features from ICEpush are covered by: createPushId, addGroupMember, register, resumeConnection*, pauseConnection*. not called by application, will be integrated with bridgeit.js or code.icepush.
        Hide
        Ted Goddard added a comment -

        To be added to bridgeit.js in http://server.ice:8888/svn/ossrepo/icemobile/branches/icemobile-bridgeit-transition/icemobile/bridgeit/src/main/javascript/bridgeit.js

        bridgeit.usePushService(serviceURL, apiKey)

        { //load code.icepush and configure ice.push.contextPath }

        bridgeit.addPushListener(groupName, callback)

        { //test for ICEpush var pushId = ice.push.createPushId(); ice.push.addGroupMember(groupName, pushId) ice.push.register([pushId], callback); }

        bridgeit.push(groupName, options)

        { //extract delay from options or merge in ICEpush API ice.push.notify(groupName, options); }

        Implementation must have a friendly warning in the console if invoked without ICEpush being loaded via usePushService():

        "BridgeIt push cannot be used without a push service. Please set one up with bridgeit.usePushService(serviceURL, apiKey)"

        Show
        Ted Goddard added a comment - To be added to bridgeit.js in http://server.ice:8888/svn/ossrepo/icemobile/branches/icemobile-bridgeit-transition/icemobile/bridgeit/src/main/javascript/bridgeit.js bridgeit.usePushService(serviceURL, apiKey) { //load code.icepush and configure ice.push.contextPath } bridgeit.addPushListener(groupName, callback) { //test for ICEpush var pushId = ice.push.createPushId(); ice.push.addGroupMember(groupName, pushId) ice.push.register([pushId], callback); } bridgeit.push(groupName, options) { //extract delay from options or merge in ICEpush API ice.push.notify(groupName, options); } Implementation must have a friendly warning in the console if invoked without ICEpush being loaded via usePushService(): "BridgeIt push cannot be used without a push service. Please set one up with bridgeit.usePushService(serviceURL, apiKey)"
        Ted Goddard made changes -
        Assignee Ted Goddard [ ted.goddard ] Mircea Toma [ mircea.toma ]
        Hide
        Ted Goddard added a comment -

        Typical application use will be:

        Perhaps in the head, but potentially elsewhere on the page:

        <script>
        bridgeit.usePushService("http://labs.icesoft.com/push/", "deadbeef")
        </script>

        In the output portion of the application:
        <script>
        bridgeit.addPushListener("chat", handleChat);
        </script>

        On an input control

        <button onclick='bridgeit.push("chat");'>Send Chat</button>

        Show
        Ted Goddard added a comment - Typical application use will be: Perhaps in the head, but potentially elsewhere on the page: <script> bridgeit.usePushService("http://labs.icesoft.com/push/", "deadbeef") </script> In the output portion of the application: <script> bridgeit.addPushListener("chat", handleChat); </script> On an input control <button onclick='bridgeit.push("chat");'>Send Chat</button>
        Hide
        Ken Fyten added a comment -
        bridgeit.usePushService(serviceURL, apiKey) {
           //load code.icepush and configure ice.push.contextPath
        }
        
        http://bridgeit.mobi/push
        
        Show
        Ken Fyten added a comment - bridgeit.usePushService(serviceURL, apiKey) { //load code.icepush and configure ice.push.contextPath } http: //bridgeit.mobi/push
        Hide
        Mircea Toma added a comment -

        Modified ICEpush to publish startConnection method so that dynamic setups can start the blocking connection without relying on document load. The method can be accessed at ice.push.connection.startConnection.

        Show
        Mircea Toma added a comment - Modified ICEpush to publish startConnection method so that dynamic setups can start the blocking connection without relying on document load. The method can be accessed at ice.push.connection.startConnection .
        Hide
        Mircea Toma added a comment -

        Implemented usePushService, addPushListener and push functions. Also tested their functionality successfully.

        Show
        Mircea Toma added a comment - Implemented usePushService , addPushListener and push functions. Also tested their functionality successfully.
        Mircea Toma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #38590 Fri Oct 11 15:41:00 MDT 2013 mircea.toma MOBI-916 Make startConnection method public so that dynamic setups can start the blocking connection without relying oo document load.
        Files Changed
        Commit graph MODIFY /icepush/trunk/icepush/core/src/main/javascript/application.js
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #38591 Fri Oct 11 15:42:27 MDT 2013 mircea.toma MOBI-916 Implemented usePushService, addPushListener and push functions.
        Files Changed
        Commit graph MODIFY /icemobile/branches/icemobile-bridgeit-transition/icemobile/bridgeit/src/main/javascript/bridgeit.js
        Hide
        Ted Goddard added a comment -

        usePushService() might be called multiple times. Would this have any side effects? (From the code it looks like the eval could run multiple times, so this should likely be guarded against.)

        Show
        Ted Goddard added a comment - usePushService() might be called multiple times. Would this have any side effects? (From the code it looks like the eval could run multiple times, so this should likely be guarded against.)
        Hide
        Ted Goddard added a comment -

        Reopening to address potential issues from redundant initialization.

        Show
        Ted Goddard added a comment - Reopening to address potential issues from redundant initialization.
        Ted Goddard made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Mircea Toma added a comment -

        Implemented detection and blocking of redundant initialisation.

        Show
        Mircea Toma added a comment - Implemented detection and blocking of redundant initialisation.
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #38602 Tue Oct 15 12:02:28 MDT 2013 mircea.toma MOBI-916 Detect redundant initialization.
        Files Changed
        Commit graph MODIFY /icemobile/branches/icemobile-bridgeit-transition/icemobile/bridgeit/src/main/javascript/bridgeit.js
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #38603 Tue Oct 15 12:02:49 MDT 2013 mircea.toma MOBI-916 Fix typo.
        Files Changed
        Commit graph MODIFY /icemobile/branches/icemobile-bridgeit-transition/icemobile/bridgeit/src/main/javascript/bridgeit.js
        Hide
        Ted Goddard added a comment - - edited

        The following strange code was added to bridgeit.push:

                 if (ice && ice.push && ice.push.configuration.contextPath) {
        -            ice.push.notify(groupName, options);
        +            if (options && options.delay)  {
        +                ice.push.notify(groupName, options, options);
        +            } else {
        +                ice.push.notify(groupName, options);
        +            }
                 } else {
        
        

        We likely do not need separate options objects in the notify call.

        Show
        Ted Goddard added a comment - - edited The following strange code was added to bridgeit.push: if (ice && ice.push && ice.push.configuration.contextPath) { - ice.push.notify(groupName, options); + if (options && options.delay) { + ice.push.notify(groupName, options, options); + } else { + ice.push.notify(groupName, options); + } } else { We likely do not need separate options objects in the notify call.
        Hide
        Ted Goddard added a comment -

        Reopened to consider merged options parameter.

        Show
        Ted Goddard added a comment - Reopened to consider merged options parameter.
        Ted Goddard made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #38607 Tue Oct 15 13:50:47 MDT 2013 ted.goddard using simplified bridgeit push API, multiple invocation of usePushService no longer fatal (MOBI-916)
        Files Changed
        Commit graph MODIFY /icemobile/branches/icemobile-bridgeit-transition/icemobile/samples/html5/bridgeit/src/main/webapp/WEB-INF/includes/mobile-jqm.html
        Commit graph MODIFY /icemobile/branches/icemobile-bridgeit-transition/icemobile/samples/html5/bridgeit/src/main/webapp/WEB-INF/includes/geospy.html
        Commit graph MODIFY /icemobile/branches/icemobile-bridgeit-transition/icemobile/samples/html5/bridgeit/src/main/webapp/WEB-INF/includes/mobile.html
        Commit graph MODIFY /icemobile/branches/icemobile-bridgeit-transition/icemobile/bridgeit/src/main/javascript/bridgeit.js
        Commit graph MODIFY /icemobile/branches/icemobile-bridgeit-transition/icemobile/samples/html5/bridgeit/src/main/webapp/WEB-INF/includes/cloud-push.html
        Hide
        Ted Goddard added a comment -

        Comment from Deryk: If BridgeIt provides a general services platform, all services should be accessible in a uniform way. For instance, a single API key should be provided only once for both the push service, location service, and echo service.

        Instead of usePushService(), an extension would be useService("http://bridgeit.mobi","push","echo") which would dynamically download the required APIs and inject them under the bridgeit.* namespace using the first argument as the base service URL. The API key could be set in a separate call bridgeit.authorize(apikey).
        Note that this requires the dependent services to be BridgeIt-aware to add their APIs under bridgeit. (icepush.js could detect window.bridgeit and add the required functions.)

        Show
        Ted Goddard added a comment - Comment from Deryk: If BridgeIt provides a general services platform, all services should be accessible in a uniform way. For instance, a single API key should be provided only once for both the push service, location service, and echo service. Instead of usePushService(), an extension would be useService("http://bridgeit.mobi","push","echo") which would dynamically download the required APIs and inject them under the bridgeit.* namespace using the first argument as the base service URL. The API key could be set in a separate call bridgeit.authorize(apikey). Note that this requires the dependent services to be BridgeIt-aware to add their APIs under bridgeit. (icepush.js could detect window.bridgeit and add the required functions.)
        Hide
        Mircea Toma added a comment -

        Created issue PUSH-285 to define the merging of the 'options' parameter task.

        Show
        Mircea Toma added a comment - Created issue PUSH-285 to define the merging of the 'options' parameter task.
        Hide
        Ted Goddard added a comment -

        There are two forms of the API to load services:

        bridgeit.useService("http://api.bridgeit.mobi/","push","echo")

        Services at different base URLs can be specified with multiple invocations of useService().

        If the version of the service needs to be specified, the service can be registered in detail:

        bridgeit.useService("http://api.bridgeit.mobi/","push",

        {name: "echo", version: "2"}

        )

        Each service must have a script file stored at a well-known location, for instance:

        http://api.bridgeit.mobi/echo/echo.js

        The script echo.js will then add its API to the bridgeit object.

        Show
        Ted Goddard added a comment - There are two forms of the API to load services: bridgeit.useService("http://api.bridgeit.mobi/","push","echo") Services at different base URLs can be specified with multiple invocations of useService(). If the version of the service needs to be specified, the service can be registered in detail: bridgeit.useService("http://api.bridgeit.mobi/","push", {name: "echo", version: "2"} ) Each service must have a script file stored at a well-known location, for instance: http://api.bridgeit.mobi/echo/echo.js The script echo.js will then add its API to the bridgeit object.
        Hide
        Ted Goddard added a comment -

        Initial integration is implemented.

        Show
        Ted Goddard added a comment - Initial integration is implemented.
        Ted Goddard made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Ted Goddard
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: