Django জ্যাঙ্গো
  • Python Basic
  • Python OOP
  • OOP Project
  • Jupyter Notebook
  • Python MOngodb
  • Numpy
  • Pandas
  • Framework কি?
  • জ্যাঙ্গো ওয়েব ফ্রেমওয়ার্ক
  • ভার্চুয়াল এনভায়র্নমেন্ট
    • ভার্চুয়াল এনভায়র্নমেন্ট তৈরী করি :
    • জ্যাংগো ইন্সটল
  • প্রথম প্রজেক্ট শুরু
    • সেটিংস পরিচিতি
    • Template
      • load css,js
        • template load
    • create project
  • অ্যাপস কি?
    • প্রথম অ্যাপস তৈরি
  • apps কে প্রজেক্টের সাথে যুক্ত করি
  • এইচটিএমএল টেমপ্লেট নিয়ে কাজ করি
    • স্ট্যাটিক ফাইল ও টেম্পলেট
    • Hompage পরিবর্তন করি
    • বেস টেমপ্লেট বানাই
    • html টেম্পলেট কে কনভার্ট করি
    • Template Tags
    • Context Processor
  • Urls
  • urls.py এ প্যারামিটার কিভাবে কাজ করে
  • message
  • Forms
    • সাধারণ একটি ফর্ম বানাই
    • ফর্ম লে আউট পরিবর্তন
    • বুটস্ট্রাপ ফর্ম
    • মডেল ফর্ম
      • Form Customization
  • models
    • মডেল বানাই
    • মাইগ্রেশন
    • মডেল ভ্যালিডেশন করা
    • মডেল কাস্টমাইজ
  • Crud
    • image Crud Admin Panel
    • Custom Crud
      • form design bootstrap
      • search Functionality
      • menu
    • File Upload App
    • Image Crud
    • Class view Crud
  • Django Authentication
    • Login/Logout(Default)
    • Registration Page(Default )
    • Profile UpdateView (Default)
    • Change Password (Default)
    • Custom Login And Registration
    • Protecting View
  • Custom Field User Model
  • Formset
    • Page 1
    • formset Crud
  • Send Email
    • Send Email From Gmail
      • Send Email With Attachment
    • Email Verification
  • Uploading Images to Cloudinary
  • Database Connection
    • MySQL
    • postgresql
  • Django Orm
    • Basic Database Operation
      • -all()
      • - get():
      • - first() and last():
      • - filter():
      • - exclude():
      • Chaining Queries
      • Creating, Updating, and Deleting Records
      • Aggregation
      • Annotation
    • Model Relationships and Related Names
      • One-to-One Relationships
      • Many-to-One Relationships
      • Many-to-Many Relationships
      • Reverse Relationships
      • Understanding related_name
    • Advanced Querying with Django ORM
      • Chaining Queries
      • F() Expressions
      • Q() Objects
        • Dynamic Search
      • Raw SQL Queries
    • Performance Optimization with Django ORM
      • Select Related
    • Django সিগন্যাল :
  • requirement.txt
  • channels
    • Create Project
    • কনফিগার
  • Send SMS in Django
    • Configuration
  • Mysql Setup
  • অ্যাডমিন প্যানেলে
    • Site Heading And Title Change
    • মডেলকে অ্যাডমিন প্যানেলে যোগ করি
    • মডেলকে একবার সেভ করা যাবে
    • এডমিন প্যানেলে পিডিএফ এক্সপোর্ট বাটন যোগ করি
    • মডেল ফর্ম কাস্টোমাইজ করি
    • মডেলের html টেম্পলেট পরিবর্তন করি
    • ফিল্ড এর ডিজাইন বুটস্ট্রাপ ফরম্যাটে হবে
    • টেবিল বেসড ফর্মসেট এপ্লিকেশন
    • নির্দিষ্ট ইউজারকে মডেলে এক্সেস পারমিশন দেয়া
    • অ্যাডমিন প্যানেলে জাভাস্ক্রিপ্ট ও css ফাইল যোগ করা
    • fetch data
    • bill of materials
  • Django Rest Framework
    • ভার্চুয়াল এনভায়র্নমেন্ট
    • প্রজেক্ট তৈরী করি
    • মডেলকে প্রস্তুত করি
    • serializer
    • Validation
    • Api তৈরী করি (api_view)
    • Api তৈরী করি (viewsets)
    • JsonResponse তৈরি করি
    • authentication
    • Reactjs
  • প্যাকেজ নিয়ে কাজ করি
    • Tinymce Editor
    • highlight.js
    • Social Login
      • Facebook
      • Github
      • google
    • Select2
      • admin panel
    • CELERY
    • Autocomplete Show Multiple Fields
      • Autocomplete Search
  • Mongodb
    • basic models,forms,views
    • Category Crud
      • Category List
      • Create Category
      • Edit Category
      • Delete Category
      • Link Button list.html
    • Tags Crud
      • Tags List
      • Create Tags
      • Edit Tags
      • Delete Tags
      • Link Button list.html
    • Post
      • Post List
      • Create Post
        • Tinymc
      • Post Details
      • Edit Post
      • Delete Post
      • Link Button list.html
      • Search
    • Comment
      • Post Details
    • Formset Crud
      • Models.py
      • forms.py
      • views
      • urls.py
      • Author
        • author_list
        • create_author
        • Edit Author
        • Delete Author
        • Link Button
      • BookFormset
    • Rest Api
    • Image Upload
  • Redis
  • chart
  • Deployment
    • Pythonanywhere
    • Cpanel Host
  • Reactjs
Powered by GitBook
On this page
  • https://medium.com/gitconnected/step-by-step-django-channels-b17a58141de1
  • Synchronous vs Asynchronous
  • Websockets

channels

Previousrequirement.txtNextCreate Project

Last updated 1 year ago

Synchronous vs Asynchronous

Let’s first look at what synchronous and asynchronous work is in terms of Django.

Django works synchronously. That is, an HTTP request is handled completely synchronously. A request is sent, waited and the response is returned.

The server is not able to send a single message to the client. In a synchronous operation, there should be a request to get a response.

In asynchronous operation, we launch a request. There is no waiting for a response, the app continues to serve the user and executes the tasks.

Websockets

Websockets is a protocol that can establish two-way communication between the browser and the server (HTTP is a one-way protocol). A client can send a message to a server and receive a message about the relevant event without having to wait for a response. Both parties can communicate with each other independently at the same time.

Websocket is a stateful protocol, meaning the connection between client and server stays alive until terminated by one of the parties (client or server). After closing the connection by either client or server, the connection is terminated from both ends.

In the first step, the client sends an HTTP request to the server. It asks the server to open a WebSocket connection. The server accepts it and returns a 101 switching protocols response. At this point, the handshake is completed. TCP/IP connection is left open and both sides can send messages. The connection remains open until one of them drops off. This process is often referred to as full-duplex.

When a client sends an HTTP request, it is received by a Django application via WSGI (web server gateway interface). It ends up in Django’s URL and is routed to Django’s view.

For WebSockets, ASGI (asynchronous server gateway interface) is in charge instead of WSGI. And it is routed to a consumer instead of a view.

A diagram describing a connection using WebSocket. Source:
Websocket Connection. Image by the author.
Comparison of HTTP and Websockets in Django App. Image by the author.
https://medium.com/gitconnected/step-by-step-django-channels-b17a58141de1
Wikipedia