In the last few blog posts, I mentioned a few migrations caused by my VSCode discovery a few weeks ago 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 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.
As I was asking in #weechat.el on freenode for help, the very quick to help 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.
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.
listen 9000 ssl;
stream section has to be outside the
If you add this configuration next to your other
server sections, it will fail.
In the previous block we make a few assumptions.
We are behind SSL: I use the nginx reverse proxy for SSL termination as it handles reloading certificates automatically. If I leave it to weechat, I have to reload the certificates manually and often.
Weechat is listening on port 9000 locally: The weechat relay needs to be configured to listen on localhost and on port 9000 for this configuration to work. Make sure to change it to fit your needs.
Now that the configuration is out of the way, let’s test it.
Open emacs and run
M-x followed by
weechat-connect. This should get you going.
It was a nice path down the road of packets. It’s always a good day when you learn new things. I have never used TCP forwarding with nginx before but I’m glad it is supported.
Now that you know how to do the same as well, I hope you give both projects a try. I think they are worth it.
I’m also thankful to have so many different awesome projects created by the open source community.