We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Docs: Channels run_in_background.py example does not work
### Summary

Hi,

i just tried to run the channels example "run_in_background.py" from the [website](https://docs.litestar.dev/2/usage/channels.html) (which translates to [run_in_background.py](https://github.com/litestar-org/litestar/blob/main/docs/examples/channels/run_in_background.py)) and found that it didn't work for me. 

I'm running Python 3.8.10 in a virtual environment with Litestar 2.4.1.

The application contains exacly the same source code that is provided in the example file and was run using `uvicorn app:app --reload`

Log output: 

```
INFO:     Started reloader process [219108] using WatchFiles
Process SpawnProcess-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/.../venv/lib/python3.8/site-packages/uvicorn/_subprocess.py", line 76, in subprocess_started
    target(sockets=sockets)
  File "/home/.../venv/lib/python3.8/site-packages/uvicorn/server.py", line 61, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
  File "/home/.../venv/lib/python3.8/site-packages/uvicorn/server.py", line 68, in serve
    config.load()
  File "/home/.../venv/lib/python3.8/site-packages/uvicorn/config.py", line 467, in load
    self.loaded_app = import_from_string(self.app)
  File "/home/.../venv/lib/python3.8/site-packages/uvicorn/importer.py", line 21, in import_from_string
    module = importlib.import_module(module_str)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/.../source/app.py", line 18, in <module>
    plugins=[ChannelsPlugin(backend=MemoryChannelsBackend())],
  File "/home/.../venv/lib/python3.8/site-packages/litestar/channels/plugin.py", line 82, in __init__
    raise ImproperlyConfiguredException("Must define either channels or set arbitrary_channels_allowed=True")
litestar.exceptions.http_exceptions.ImproperlyConfiguredException: 500: Must define either channels or set arbitrary_channels_allowed=True
```

This error is easy to resolve. I've changed 

    plugins=[ChannelsPlugin(backend=MemoryChannelsBackend())],

 to

    plugins=[ChannelsPlugin(backend=MemoryChannelsBackend(), channels=["general"])],

and the app started up successfully. 

But there seems to be another problem. As soon as my browser connects to the websocket, I get the following warning:

```
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [219218] using WatchFiles
INFO:     Started server process [219220]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     ('127.0.0.1', 33682) - "WebSocket /ws" [accepted]
/home/...../source/app.py:10: RuntimeWarning: coroutine 'ChannelsPlugin.subscribe' was never awaited
  async with channels.subscribe(["some_channel"]) as subscriber, subscriber.run_in_background(socket.send_text):
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
INFO:     connection open
INFO:     connection closed
```

I'm not sure how to resolve this problem. Probably the documentation does not refect the current state of Litestar? Could you check if the example is still valid? Thank you :-) 



<!-- POLAR PLEDGE BADGE START -->
---
> [!NOTE]  
> While we are open for sponsoring on [GitHub Sponsors](https://github.com/sponsors/litestar-org/) and 
> [OpenCollective](https://opencollective.com/litestar), we also utilize [Polar.sh](https://polar.sh/) to engage in pledge-based sponsorship.
>
> Check out all issues funded or available for funding [on our Polar.sh Litestar dashboard](https://polar.sh/litestar-org)
> * If you would like to see an issue prioritized, make a pledge towards it!
> * We receive the pledge once the issue is completed & verified
> * This, along with engagement in the community, helps us know which features are a priority to our users.

<a href="https://polar.sh/litestar-org/litestar/issues/2813">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/litestar-org/litestar/issues/2813/pledge.svg?darkmode=1">
  <img alt="Fund with Polar" src="https://polar.sh/api/github/litestar-org/litestar/issues/2813/pledge.svg">
</picture>
</a>
<!-- POLAR PLEDGE BADGE END -->


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `docs/examples/channels/run_in_background.py`
Content:
```
1 from litestar import Litestar, WebSocket, websocket
2 from litestar.channels import ChannelsPlugin
3 from litestar.channels.backends.memory import MemoryChannelsBackend
4 
5 
6 @websocket("/ws")
7 async def handler(socket: WebSocket, channels: ChannelsPlugin) -> None:
8     await socket.accept()
9 
10     async with channels.subscribe(["some_channel"]) as subscriber, subscriber.run_in_background(socket.send_text):
11         while True:
12             await socket.receive_text()
13             # do something with the message here
14 
15 
16 app = Litestar(
17     [handler],
18     plugins=[ChannelsPlugin(backend=MemoryChannelsBackend())],
19 )
20
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/docs/examples/channels/run_in_background.py b/docs/examples/channels/run_in_background.py
--- a/docs/examples/channels/run_in_background.py
+++ b/docs/examples/channels/run_in_background.py
@@ -7,13 +7,13 @@
 async def handler(socket: WebSocket, channels: ChannelsPlugin) -> None:
     await socket.accept()
 
-    async with channels.subscribe(["some_channel"]) as subscriber, subscriber.run_in_background(socket.send_text):
+    async with await channels.subscribe(["some_channel"]) as subscriber, subscriber.run_in_background(socket.send_text):
         while True:
-            await socket.receive_text()
-            # do something with the message here
+            response = await socket.receive_text()
+            await subscriber.send(response)
 
 
 app = Litestar(
     [handler],
-    plugins=[ChannelsPlugin(backend=MemoryChannelsBackend())],
+    plugins=[ChannelsPlugin(backend=MemoryChannelsBackend(), channels=["some_channel"])],
 )

{"golden_diff": "diff --git a/docs/examples/channels/run_in_background.py b/docs/examples/channels/run_in_background.py\n--- a/docs/examples/channels/run_in_background.py\n+++ b/docs/examples/channels/run_in_background.py\n@@ -7,13 +7,13 @@\n async def handler(socket: WebSocket, channels: ChannelsPlugin) -> None:\n     await socket.accept()\n \n-    async with channels.subscribe([\"some_channel\"]) as subscriber, subscriber.run_in_background(socket.send_text):\n+    async with await channels.subscribe([\"some_channel\"]) as subscriber, subscriber.run_in_background(socket.send_text):\n         while True:\n-            await socket.receive_text()\n-            # do something with the message here\n+            response = await socket.receive_text()\n+            await subscriber.send(response)\n \n \n app = Litestar(\n     [handler],\n-    plugins=[ChannelsPlugin(backend=MemoryChannelsBackend())],\n+    plugins=[ChannelsPlugin(backend=MemoryChannelsBackend(), channels=[\"some_channel\"])],\n )\n", "issue": "Docs: Channels run_in_background.py example does not work\n### Summary\r\n\r\nHi,\r\n\r\ni just tried to run the channels example \"run_in_background.py\" from the [website](https://docs.litestar.dev/2/usage/channels.html) (which translates to [run_in_background.py](https://github.com/litestar-org/litestar/blob/main/docs/examples/channels/run_in_background.py)) and found that it didn't work for me. \r\n\r\nI'm running Python 3.8.10 in a virtual environment with Litestar 2.4.1.\r\n\r\nThe application contains exacly the same source code that is provided in the example file and was run using `uvicorn app:app --reload`\r\n\r\nLog output: \r\n\r\n```\r\nINFO:     Started reloader process [219108] using WatchFiles\r\nProcess SpawnProcess-1:\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python3.8/multiprocessing/process.py\", line 315, in _bootstrap\r\n    self.run()\r\n  File \"/usr/lib/python3.8/multiprocessing/process.py\", line 108, in run\r\n    self._target(*self._args, **self._kwargs)\r\n  File \"/home/.../venv/lib/python3.8/site-packages/uvicorn/_subprocess.py\", line 76, in subprocess_started\r\n    target(sockets=sockets)\r\n  File \"/home/.../venv/lib/python3.8/site-packages/uvicorn/server.py\", line 61, in run\r\n    return asyncio.run(self.serve(sockets=sockets))\r\n  File \"/usr/lib/python3.8/asyncio/runners.py\", line 44, in run\r\n    return loop.run_until_complete(main)\r\n  File \"uvloop/loop.pyx\", line 1517, in uvloop.loop.Loop.run_until_complete\r\n  File \"/home/.../venv/lib/python3.8/site-packages/uvicorn/server.py\", line 68, in serve\r\n    config.load()\r\n  File \"/home/.../venv/lib/python3.8/site-packages/uvicorn/config.py\", line 467, in load\r\n    self.loaded_app = import_from_string(self.app)\r\n  File \"/home/.../venv/lib/python3.8/site-packages/uvicorn/importer.py\", line 21, in import_from_string\r\n    module = importlib.import_module(module_str)\r\n  File \"/usr/lib/python3.8/importlib/__init__.py\", line 127, in import_module\r\n    return _bootstrap._gcd_import(name[level:], package, level)\r\n  File \"<frozen importlib._bootstrap>\", line 1014, in _gcd_import\r\n  File \"<frozen importlib._bootstrap>\", line 991, in _find_and_load\r\n  File \"<frozen importlib._bootstrap>\", line 975, in _find_and_load_unlocked\r\n  File \"<frozen importlib._bootstrap>\", line 671, in _load_unlocked\r\n  File \"<frozen importlib._bootstrap_external>\", line 848, in exec_module\r\n  File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed\r\n  File \"/home/.../source/app.py\", line 18, in <module>\r\n    plugins=[ChannelsPlugin(backend=MemoryChannelsBackend())],\r\n  File \"/home/.../venv/lib/python3.8/site-packages/litestar/channels/plugin.py\", line 82, in __init__\r\n    raise ImproperlyConfiguredException(\"Must define either channels or set arbitrary_channels_allowed=True\")\r\nlitestar.exceptions.http_exceptions.ImproperlyConfiguredException: 500: Must define either channels or set arbitrary_channels_allowed=True\r\n```\r\n\r\nThis error is easy to resolve. I've changed \r\n\r\n    plugins=[ChannelsPlugin(backend=MemoryChannelsBackend())],\r\n\r\n to\r\n\r\n    plugins=[ChannelsPlugin(backend=MemoryChannelsBackend(), channels=[\"general\"])],\r\n\r\nand the app started up successfully. \r\n\r\nBut there seems to be another problem. As soon as my browser connects to the websocket, I get the following warning:\r\n\r\n```\r\nINFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)\r\nINFO:     Started reloader process [219218] using WatchFiles\r\nINFO:     Started server process [219220]\r\nINFO:     Waiting for application startup.\r\nINFO:     Application startup complete.\r\nINFO:     ('127.0.0.1', 33682) - \"WebSocket /ws\" [accepted]\r\n/home/...../source/app.py:10: RuntimeWarning: coroutine 'ChannelsPlugin.subscribe' was never awaited\r\n  async with channels.subscribe([\"some_channel\"]) as subscriber, subscriber.run_in_background(socket.send_text):\r\nRuntimeWarning: Enable tracemalloc to get the object allocation traceback\r\nINFO:     connection open\r\nINFO:     connection closed\r\n```\r\n\r\nI'm not sure how to resolve this problem. Probably the documentation does not refect the current state of Litestar? Could you check if the example is still valid? Thank you :-) \r\n\r\n\r\n\r\n<!-- POLAR PLEDGE BADGE START -->\r\n---\r\n> [!NOTE]  \r\n> While we are open for sponsoring on [GitHub Sponsors](https://github.com/sponsors/litestar-org/) and \r\n> [OpenCollective](https://opencollective.com/litestar), we also utilize [Polar.sh](https://polar.sh/) to engage in pledge-based sponsorship.\r\n>\r\n> Check out all issues funded or available for funding [on our Polar.sh Litestar dashboard](https://polar.sh/litestar-org)\r\n> * If you would like to see an issue prioritized, make a pledge towards it!\r\n> * We receive the pledge once the issue is completed & verified\r\n> * This, along with engagement in the community, helps us know which features are a priority to our users.\r\n\r\n<a href=\"https://polar.sh/litestar-org/litestar/issues/2813\">\r\n<picture>\r\n  <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://polar.sh/api/github/litestar-org/litestar/issues/2813/pledge.svg?darkmode=1\">\r\n  <img alt=\"Fund with Polar\" src=\"https://polar.sh/api/github/litestar-org/litestar/issues/2813/pledge.svg\">\r\n</picture>\r\n</a>\r\n<!-- POLAR PLEDGE BADGE END -->\r\n\n", "before_files": [{"content": "from litestar import Litestar, WebSocket, websocket\nfrom litestar.channels import ChannelsPlugin\nfrom litestar.channels.backends.memory import MemoryChannelsBackend\n\n\n@websocket(\"/ws\")\nasync def handler(socket: WebSocket, channels: ChannelsPlugin) -> None:\n    await socket.accept()\n\n    async with channels.subscribe([\"some_channel\"]) as subscriber, subscriber.run_in_background(socket.send_text):\n        while True:\n            await socket.receive_text()\n            # do something with the message here\n\n\napp = Litestar(\n    [handler],\n    plugins=[ChannelsPlugin(backend=MemoryChannelsBackend())],\n)\n", "path": "docs/examples/channels/run_in_background.py"}], "after_files": [{"content": "from litestar import Litestar, WebSocket, websocket\nfrom litestar.channels import ChannelsPlugin\nfrom litestar.channels.backends.memory import MemoryChannelsBackend\n\n\n@websocket(\"/ws\")\nasync def handler(socket: WebSocket, channels: ChannelsPlugin) -> None:\n    await socket.accept()\n\n    async with await channels.subscribe([\"some_channel\"]) as subscriber, subscriber.run_in_background(socket.send_text):\n        while True:\n            response = await socket.receive_text()\n            await subscriber.send(response)\n\n\napp = Litestar(\n    [handler],\n    plugins=[ChannelsPlugin(backend=MemoryChannelsBackend(), channels=[\"some_channel\"])],\n)\n", "path": "docs/examples/channels/run_in_background.py"}]}