Instruction: Describe how middleware is used in Django Channels and the process of creating custom middleware for real-time Django applications.
Context: The candidate should demonstrate understanding of the Django Channels library and how middleware can be utilized to process requests in a WebSocket environment.