jrief / django-websocket-redis

Websockets for Django applications using Redis as message queue
http://django-websocket-redis.awesto.com/
MIT License
895 stars 222 forks source link

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

Open aaaref opened 7 years ago

aaaref commented 7 years ago

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?

jrief commented 7 years ago

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.

aaaref commented 7 years ago

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 notifications@github.com 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_ .

jrief commented 7 years ago

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!

aaaref commented 7 years ago

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" notifications@github.com 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_ .