Package: asgi_ipc
An ASGI channel layer that uses POSIX shared memory IPC as its backing store
(only works between processes on the same machine).IPC is still a bit of a wild west of UNIX compatability, so if you find weird
errors, please file an issue with details and exact system specifications. In
partcular, this module is tested and works well on Linux kernels and the Windows
Subsystem for Linux; it also works on Mac OS but will not be able to detect
deadlock situations due to limitations in the kernel.UsageYou’ll need to instantiate the channel layer with a path prefix to create
IPC objects underneath; any channel layers with the same prefix will talk to
each other as long as they’re on the same machine.Example:importasgi_ipcasasgichannel_layer=asgi.IPCChannelLayer(prefix="aeracode",message_memory=200*1024*1024,)channel_layer.send("my_channel",{"text":"Hello ASGI"})print(channel_layer.receive(["my_channel",]))prefixPrefix to use for IPC objects under the root namespace. Defaults toasgi.
IPC layers on the same machine with the same prefix will talk to each other.message_memoryThe amount of shared memory to allocate to the channel storage, in bytes.
Defaults to 100MB. All of your in-flight messages must fit into this,
otherwise you’ll getChannelFullerrors if the memory space is full up.ASGI messages can be a maximum of one megabyte, and are usually much smaller.
The IPC routing metadata on top of each message is approximately 50 bytes.group_memoryThe amount of shared memory to allocate to the group storage, in bytes.
Defaults to 20MB. All of your group membership data must fit into this space,
otherwise your group memberships may fail to persist.You can fit approximately 4000 group-channel membership associations into one
megabyte of memory.expiryMessage expiry in seconds. Defaults to60. You generally shouldn’t need
to change this, but you may want to turn it down if you have peaky traffic you
wish to drop, or up if you have peaky traffic you want to backlog until you
get to it.group_expiryGroup expiry in seconds. Defaults to86400. Interface servers will drop
connections after this amount of time; it’s recommended you reduce it for a
healthier system that encourages disconnections.capacityDefault channel capacity. Defaults to100. Once a channel is at capacity,
it will refuse more messages. How this affects different parts of the system
varies; a HTTP server will refuse connections, for example, while Django
sending a response will just wait until there’s space.channel_capacityPer-channel capacity configuration. This lets you tweak the channel capacity
based on the channel name, and supports both globbing and regular expressions.It should be a dict mapping channel name pattern to desired capacity; if the
dict key is a string, it’s intepreted as a glob, while if it’s a compiledreobject, it’s treated as a regular expression.This example setshttp.requestto 200, allhttp.response!channels
to 10, and allwebsocket.send!channels to 20:channel_capacity={"http.request":200,"http.response!*":10,re.compile(r"^websocket.send\!.+"):20,}If you want to enforce a matching order, use anOrderedDictas the
argument; channels will then be matched in the order the dict provides them.DependenciesAll Channels projects currently support Python 2.7, 3.4 and 3.5.ContributingPlease refer to themain Channels contributing docs.
That also contains advice on how to set up the development environment and run the tests.Maintenance and SecurityTo report security issues, please contactsecurity@djangoproject.com. For GPG
signatures and more security process information, seehttps://docs.djangoproject.com/en/dev/internals/security/.To report bugs or request new features, please open a new GitHub issue.This repository is part of the Channels project. For the shepherd and maintenance team, please see themain Channels readme.