User sign in - broken pipe / lost communication

Hi, I have implemented registerUser and loginUser functions. I am more often than not experiencing lost communication, and certain user information (that only applies to “logged in” users) just does not show up. I check the console when this happens and it appears that sometimes the user session token is different, but no error is reported. This may or may not be the cause. When I go to a different scene and go back to the previous screen, the correct information displays again.  Here is what I see on the console:

May 27 04:35:15.530 result:

May 27 04:35:15.530    sessionToken: 78948d893ed105a88febdb4693a7aaf8

May 27 04:35:15.540 result:

May 27 04:35:15.540    sessionToken: 4c53e2a79ac2c1a96f4993b70d426916

May 27 04:35:15.540 error: Session expired

 


 

Here is a snippet of my code:

mc:setSessionToken()

 mc:loginUser(userEmailCheck, userPasswordCheck, function( event1 )

if( signedIn == nil) or (signedIn == “0”) or (signedIn == “”) then

registerText(title, “New user? Register here”, -15, 220, 15, signUpEvent)

menuText(title, “Sign In”, -15, 180, 15, signInEvent)

end

        – if not event1.error then

        if( signedIn == “1”) then

        – returnUser()

        mc:getMe( function(e)

        – if not e.error then

        registerText(title, “G’day,”…" "…e.result.name, -15, 220, 15, myAccountEvent)

        menuText(title, “View Account”, -15, 180, 15, myAccountEvent)


Please advise!

Thanks!

David

Hi,

Where are you including the Coronium module? Are you using Composer? And, do you declare Coronium on each “scene” or in the main.lua?

Cheers.

Hi,

Thanks for your response. I am using Composer, and this is what I declare on all my scenes (including main.lua)

  local composer = require( “composer” )

  local json = require(“json”)

  local mime = require(“mime”)

  local widget = require( “widget” )

  local globals = require( “globals” )

  local stores = require(“stores”)

  local mc = require( “mod_coronium” )

  local theStore = require(“theStore”)

  local actionLua = require(“actionLua”)

So yes, I declare Coronium on all scenes.

Also, not sure if it means anything but most of my code is in this section: function scene:create( event )

Thanks!

… And when I change to a new scene I remove that current scene

Hi,

I’m trying to dig up the post that explains this in more detail, but generally if you’re using Storyboard or Composer you need to treat mod_coronium as a “global” service. In other words, it should only be initialized once in your main entry point.

Cheers.

Do you mean declare local mc = require( “mod_coronium” ) without the local? And only on the main.lua page? I have it once only on all scenes at the very top. I do not declare it more than once on any scene

Hi,

I’ll need to run it through Composer to give solid advice. I have only done Storyboard based tests.

Cheers.

Hi,

Where are you including the Coronium module? Are you using Composer? And, do you declare Coronium on each “scene” or in the main.lua?

Cheers.

Hi,

Thanks for your response. I am using Composer, and this is what I declare on all my scenes (including main.lua)

  local composer = require( “composer” )

  local json = require(“json”)

  local mime = require(“mime”)

  local widget = require( “widget” )

  local globals = require( “globals” )

  local stores = require(“stores”)

  local mc = require( “mod_coronium” )

  local theStore = require(“theStore”)

  local actionLua = require(“actionLua”)

So yes, I declare Coronium on all scenes.

Also, not sure if it means anything but most of my code is in this section: function scene:create( event )

Thanks!

… And when I change to a new scene I remove that current scene

Hi,

I’m trying to dig up the post that explains this in more detail, but generally if you’re using Storyboard or Composer you need to treat mod_coronium as a “global” service. In other words, it should only be initialized once in your main entry point.

Cheers.

Do you mean declare local mc = require( “mod_coronium” ) without the local? And only on the main.lua page? I have it once only on all scenes at the very top. I do not declare it more than once on any scene

Hi,

I’ll need to run it through Composer to give solid advice. I have only done Storyboard based tests.

Cheers.