django-websocket-redis icon indicating copy to clipboard operation
django-websocket-redis copied to clipboard

How to use djang-websocket integrated with a customer authentication mechansim

Open aaaref opened this issue 8 years ago • 4 comments

For many stupid reasons and mistakes in the past, we are not using django authentication, now, how should we be using django-websocket-redis without django authentication?

aaaref avatar Feb 07 '17 14:02 aaaref

If it's for the broadcast only, then go ahead with ws4redis as it is right now.

Otherwise, I strongly suggest to refactor your code to use Django authentication. Sooner or later you'll have to do it anyway.

jrief avatar Feb 07 '17 15:02 jrief

wholeheartedly agreed that we should refactor to django authentication, but it takes weeks to finish.

From documentation, seems I can send notifs by session id, correct? what if I fetch anonyomous *session_key *from django and save it myself, so I can use to use *notif_by_sessionkey *instead of notif_by_user?

Aref.

On Tue, Feb 7, 2017 at 6:34 PM, Jacob Rief [email protected] wrote:

If it's for the broadcast only, then go ahead with ws4redis as it is right now.

Otherwise, I strongly suggest to refactor your code to use Django authentication. Sooner or later you'll have to do it anyway.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jrief/django-websocket-redis/issues/220#issuecomment-278026271, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5ftPSRPDJflExrcSOPjOOshU8uFJdOks5raIgagaJpZM4L5k2_ .

aaaref avatar Feb 07 '17 16:02 aaaref

Notify by sessionkey should work.

I would strongly suggest to store the session data in Redis as well, then you do not run into the risk of performing a blocking operation.

Remember: Green threads are only non-blocking, if monkey patched!

jrief avatar Feb 07 '17 17:02 jrief

Yes, we have to save session data. And I see the point in saving in redis, so we dont run to the possible block of running into a blocking operation when fetching session key before socket operation.

And pls, can u elaborate further on this sentence: "Green threads are only non-blocking, if monkey patched" annd what exactly it means here? I only ask bcz u said "remember" and I feel like I have someething to learn here. I know green threads and I understand what is monkey patching. But, I dont understand the point here.

Much thanks for sharing your contribution and a million thanks for replying on this conversation.

Cheers.

On Feb 7, 2017 9:09 PM, "Jacob Rief" [email protected] wrote:

Notify by sessionkey should work.

I would strongly suggest to store the session data in Redis as well, then you do not run into the risk of performing a blocking operation.

Remember: Green threads are only non-blocking, if monkey patched!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jrief/django-websocket-redis/issues/220#issuecomment-278078206, or mute the thread https://github.com/notifications/unsubscribe-auth/AA5ftKKQ_UE9hzFH5Y-Ltxlv2RpOEW3Mks5raKw8gaJpZM4L5k2_ .

aaaref avatar Feb 07 '17 18:02 aaaref