llaske / sugarizer

Sugarizer is a web implementation of the Sugar platform to run on any device or browser
https://sugarizer.org
Apache License 2.0
198 stars 411 forks source link

when connected to server, activities get shared automatically #810

Closed prakashujjwal1010 closed 4 years ago

prakashujjwal1010 commented 4 years ago

when connected to server, activities get shared automatically without even clicking network button. I tested with both dev.sugarizer.org and local server on even different laptops in dev branch . also tested on https://dev.sugarizer.org/ The issue doesn't occur in master branch. from this issue several activities are having problem like In last one loses activity we are not able to play vs computer mode(single player mode). see below ezgif com-video-to-gif (14)

The issue was not there until some weeks ago ( when i was developing chess activity).

will be very helpful if other contributors can verify this issue.

dhruvmisra commented 4 years ago

Hey @prakashujjwal1010, I tried to replicate the issue on my side but I wasn't successful. The activity was not being shared automatically after opening it. I tried running the local server and also on https://dev.sugarizer.org/. Could you explain the steps you followed? Or could you mention other activities you are facing this issue with?

I did notice a different strange behavior: If I click on the single-user mode (left one with icon: zoom-home.svg) in the presence palette, it still shares the activity. Only this time the styling of the presence palette is a little off, as can be seen in the GIF uploaded by you.

I think it's happening after lib/sugar-web/presence.js was updated to show the connected users. The problem you are facing might also be linked to this. @llaske, can you confirm the odd behavior on your side?

prakashujjwal1010 commented 4 years ago

Steps to replicate the issue:

I am facing this issue on all the activities which have multiuser feature (presence)

dhruvmisra commented 4 years ago

Weird, I still couldn't replicate it. :( I tried it with a different browser too. Try clearing your browser cache, maybe that'll help?

prakashujjwal1010 commented 4 years ago

yes, i tried clearing cache also...but still getting the same. i even tested it on my phone browser, still getting the issue... :(

llaske commented 4 years ago

Same for me, I can't reproduce the issue on my side :-( BTW @dhruvmisra you're right regarding the weird behavior: clicking on the Private button shared the activity... could you fill an issue on this. And yes, I've updated recently the presence palette so a difference between dev and master branch is possible.

llaske commented 4 years ago

@prakashujjwal1010 could you try with different network speed (choose from the Network sheet in the Chrome dev window)?

prakashujjwal1010 commented 4 years ago

@llaske @dhruvmisra please try this :

ezgif com-video-to-gif (15)

dhruvmisra commented 4 years ago

Yes! It happened with me too. Paint automatically shared an instance. I opened Last One Loses, it didn't share it automatically but once I shared it myself and closed the activity, every time I open it again it shares it automatically.

EDIT: It doesn't happen to me locally though when I'm running the server from sugarizer-server repository. When you mentioned about being connected to server, did you connect to a local sugarizer-server or the https://dev.sugarizer.org/?

llaske commented 4 years ago

Unfortunately I can't reproduce on my side, even with the detailed steps :-(

I've fixed in https://github.com/llaske/sugarizer/pull/813 the related issue https://github.com/llaske/sugarizer/issues/811. @prakashujjwal1010 @dhruvmisra Could you check if this PR fix both issues on your side?

prakashujjwal1010 commented 4 years ago

@dhruvmisra , yes you are right the issue doesn't exist when connected to local remote sugarizer-server but when connected to dev.sugarizer.org, it is there.

@llaske , when connected to sugarizer-server it solves the #811 on my side.

but when connected to https://dev.sugarizer.org/ now network button is not working means the activity is not getting shared on clicking network button. :(

don't know the reason behind this difference when connected to different servers, as it should behave same

llaske commented 4 years ago

@prakashujjwal1010 thanks for the detailed description of the issue. It helps me a lot to understand the problem. The difference with a local server and dev.sugarizer.org - and also the reason why I can't reproduce the issue on my side - is that it depends of the network latency to accept connection. I've finally reproduce the issue on my side by forcing my local server to 1 second wait before accepting connection (here for information). With this one second latency I was able to reproduce both issue: automatic share and disable of network buttons.

I've updated the https://github.com/llaske/sugarizer/pull/813 PR to integrate the fix.

@prakashujjwal1010 @dhruvmisra could you test again on your side to see if it works now?

dhruvmisra commented 4 years ago

I changed the network throttling in Chrome Dev tools to 'Mid-tier mobile' and I was able to reproduce the issue using local server as well.

@llaske The PR does fix the issue. No problems after network throttling as well.

Also thanks to @prakashujjwal1010, now that I have your attention on Last One Loses activity, I think the workflow after sharing the activity can be improved. As you can see, the user who shares the activity can't play the game until some other user connects and is also stuck if the connected user leaves in the middle. (As pointed out by @sarthak-g in #722). I think the solution proposed to let the user play against computer is good and feels intuitive. I agree that the duration of the LOL game is small but I think that shouldn't be a reason to provide a bad experience (restarting to play if activity got shared) to the user. What do you say?

prakashujjwal1010 commented 4 years ago

@llaske , the issue is fixed now, on my side. thanks. @dhruvmisra , yes I think letting user play until another user connects or if opponent leaves in the middle is a good idea.

llaske commented 4 years ago

Thanks to both of you.

@dhruvmisra I'm agree regarding Last One Loses activity. Please fill an issue regarding that.

llaske commented 4 years ago

Fixed in https://github.com/llaske/sugarizer/commit/95e9cd2b0f26d48a058b01fd7928c9ee97928467