+++ title = "Weechat and Emacs" author = ["Elia el Lazkani"] date = 2020-09-03 lastmod = 2020-09-03 tags = ["weechat", "emacs", "weechat-el"] categories = ["irc"] draft = false +++ In the last few blog posts, I mentioned a few migrations caused by my _VSCode_ discovery a few weeks ago [Emacs and Org-mode]({{< relref "emacs-and-org-mode" >}}). As I was configuring _Doom_, I noticed that there was a configuration for _weechat_ in there. I checked it out very briefly and found that it was a _[weechat.el](https://github.com/the-kenny/weechat.el)_ package for _Emacs_. At the time, I didn't have too much time to spend on this so I quickly passed it over with plans to come back to it, _eventually_. The time has come for me to configure and try this at least ! I already have my _weechat_ installation running remotely behind an _nginx_ **reverse proxy**. I tried to connecting using that endpoint, unfortunately no dice. ## The Problem {#the-problem} As I was asking in _#weechat.el_ on **freenode** for help, the very quick to help _[FlashCode](https://github.com/flashcode)_ sprung into action. He wasn't able to help me but he pointed me in the right direction. I asked why would _Glowing Bear_ work but not _weechat.el_ ? The answer was along the line that _Glowing Bear_ uses a _websocket_. Alright that made sense. Maybe _weechat.el_ does not do _websocket_. ## The Solution {#the-solution} So, we are behind an _nginx_ **reverse proxy** instance. What we need to do is expose our service as a _TCP reverse proxy_ instead of our usual _HTTP_ one. We are moving down networking layers to the **TCP/IP** instead of **HTTP**. What we need to do is add a _stream_ section to our _nginx_ to accomplish this. ```text stream { server { listen 9000 ssl; ssl_certificate /path/to/chain.pem; ssl_certificate_key /path/to/cert.pem; proxy_pass 127.0.0.1:9000; } } ```
warning
The `stream` section has to be outside the `http` section. If you add this configuration next to your other `server` sections, it will fail.