Rocket Modern Experience (formerly LegaSuite)

 View Only
  • 1.  EmulatorConnect() With DeviceName from LocalStorage

    Posted 8 days ago

    Users can hit our MX Web 10.4.2 installation and have device names automatically assigned, but that's not the desired behavior since our host application makes extensive use of pre-configured device names. We know how to pass a DeviceName via a URL parm, but our users are resistant to saving a bookmark or typing the parm. I would like to let users click a button on our logon page to switch their device. I'm able to use the EmulatorConnect function to switch to their specified device but users don't want to do this every time they visit. We need to make their device "sticky" so it's remembered from session to session on that machine. <insert annoyed grumbling about users here>

    A browser's LocalStorage is accessible via JavaScript, and I thought that might be an option for making the device name sticky. 

    1. User hits our base URL and gets auto-assigned QPADEVxxxxxx
    2. User switches to their device via EmulatorConnect....say, MIKEPRT
    3. App writes DeviceName to LocalStorage
    4. All subsequent visits - user hits our base URL but app checks LocalStorage and uses EmulatorConnect to automatically switch from QPADEVxxxx to the correct device (MIKEPRT)

    I'm not very familiar with the JavaScript plumbing and am getting quite tangled up. I've been digging around for some object models but not coming up with much useful. Can anyone provide some guidance on how to implement this sort of behavior?

    Mike Warren
    Software Development Manager, GOLD Team Leader
    Grand Rapids MI US

  • 2.  RE: EmulatorConnect() With DeviceName from LocalStorage

    Posted 5 days ago
    Edited by Roger Van Valen 4 days ago

    Hi Mike,

    I do not have a complete example available, but can surely share some thoughts.
    You can find on the net how to retrieve and put values to the local storage using the localStorage object, and also examples on validating if the value was actually available or not (getItem() will return null or undefined).

    Using a breakpoint using a 'debugger;' statement and opening the developer tools from the browser will also let you experiment with it within your code:

    > localStorage.getItem("Roger");
    < null
    > localStorage.setItem("Roger", "BlahBlah");
    < undefined
    > localStorage.getItem("Roger");
    < 'BlahBlah'

    For your solution it would be best to initiate directly with the 'correct' devicename, instead of first using a standard and then disconnect/reconnect with the preferred one. This would improve performance as no two connects are required. 

    There can be several ways to do this, for instance:

    • Start using the NULL emulator (so no connection at all)
      Then check for stored devicename, if so, use that for an EmulatorConnect
      If not, then connect using standard device name (or pop up a  page to select it without connection), and when user switched, save the new preferred device name.
    • Delay loading of index,html (or an alternative page with the actual client load) and first process JavaScript to see if a device name is set. If so, open de index.html or alternative including the device name.

    Hope this helps some,

    Roger van Valen
    Senior manager, software engineering
    Rocket Software
    Dordrecht, The Netherlands