https://github.com/nozeio/swift-nio-irc-server
A Internet Relay Chat (IRC) server for SwiftNIO
https://github.com/nozeio/swift-nio-irc-server
eliza-chatbot irc-client irc-server swift-nio swift4
Last synced: about 1 year ago
JSON representation
A Internet Relay Chat (IRC) server for SwiftNIO
- Host: GitHub
- URL: https://github.com/nozeio/swift-nio-irc-server
- Owner: NozeIO
- License: apache-2.0
- Created: 2018-04-24T14:15:31.000Z (about 8 years ago)
- Default Branch: develop
- Last Pushed: 2019-03-29T18:08:48.000Z (about 7 years ago)
- Last Synced: 2025-05-07T03:44:33.467Z (about 1 year ago)
- Topics: eliza-chatbot, irc-client, irc-server, swift-nio, swift4
- Language: Swift
- Size: 55.7 KB
- Stars: 39
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# SwiftNIO IRC Server





[SwiftNIO IRC](https://github.com/NozeIO/swift-nio-irc)
is a Internet Relay Chat protocol implementation for
[SwiftNIO](https://github.com/apple/swift-nio),
a basis for building your own IRC servers and clients,
a sample IRC server, as well as some IRC bots written in the
[Swift](http://swift.org) programming language.
*SwiftNIO IRC Server* is a framework to build IRC servers on top of
[SwiftNIO IRC](https://github.com/NozeIO/swift-nio-irc).
Want to build a customer-support chat system?
And your customers happen to be Unix people from the 80s and early 90s?
What a great match!
This Swift package contains the reusable `IRCServer` module,
and the `MiniIRCd`, a small and working IRC sample server.
MiniIRCd also configures, embeds and runs:
- [swift-nio-irc-webclient](https://github.com/NozeIO/swift-nio-irc-webclient) -
a simple IRC webclient + WebSocket gateway based on SwiftNIO IRC, and
- [swift-nio-irc-eliza](https://github.com/NozeIO/swift-nio-irc-eliza) -
a cheap yet scalable therapist.
## What it looks like
On the surface it is a very simple chat webapp, with basic support for
channels and direct messages:

**Sometimes** a live demo installation is running on
[http://irc.noze.io/](http://irc.noze.io/).
Apart from the web frontend, MiniIRCd also embeds an actual IRC server, that is,
you can connect to the server using native clients like
[Mutter](https://www.mutterirc.com),
[Irssi](https://irssi.org)
or
[Textual](https://www.codeux.com/textual/).

## Overview
The `IRCServer` module which is part of this package, only links against the
`NIOIRC`
protocol module of [SwiftNIO IRC](https://github.com/NozeIO/swift-nio-irc).
The included `MiniIRCd` tool on the other hand, also spins up the
[IRC/WebSocket gateway](https://github.com/NozeIO/swift-nio-irc-webclient),
includes the webapp and starts up the
[ElizaBot](https://github.com/NozeIO/swift-nio-irc-eliza).
```
┌──────────────────────────────────────────────────┐
│ ┌───────────────────────┐ ┌──────────────┐ │
HTML │ │ ┌─────────────────┐ │ │ Eliza │ │
┌───────JS───────────┼─┼──│ NIO HTTP Server │ │ │ Bot │ │
│ │ │ └─────────────────┘ │ └──────────────┘ │
│ │ │ │ │ │ │
▼ │ │ Upgrades │ IRC │
┌──────────────┐ │ │ Connection │ │ │
│ │ │ │ │ │ ▼ │
│ WebBrowser │ │ │ ▼ │ ┌──────────────┐ │
│ │ WebSocket │ │ ┌─────────────────┐ │ │ │ │
│ JavaScript │◀────JSON────┼─┼─▶│ NIO WebSocket │◀─┼─IRC──▶│ IRC Server │ │
│ WebApp │ │ │ └─────────────────┘ │ │ │ │
│ │ │ │ WebServer │ └──────────────┘ │
└──────────────┘ │ └───────────────────────┘ │
│ │
│ All Services Run as Part of MiniIRCd │
└──────────────────────────────────────────────────┘
```
## Running the Server
To get started, just checkout the repository and call `swift run`:
```
helge@ZeaPro swift-nio-irc-server (develop)*$ swift run
Fetching https://github.com/apple/swift-nio.git
...
Compile Swift Module 'miniircd' (2 sources)
Linking ./.build/x86_64-apple-macosx10.10/debug/miniircd
__ __ _ _ _____ _____ _____
| \/ (_) (_)_ _| __ \ / ____| Swift IRCd
| \ / |_ _ __ _ | | | |__) | |
| |\/| | | '_ \| | | | | _ /| | Port: 6667
| | | | | | | | |_| |_| | \ \| |____ PID: 2343
|_| |_|_|_| |_|_|_____|_| \_\\_____|
Ready to accept connections on: [IPv4]0.0.0.0:6667
IRCWebClientServer running on: [IPv4]0.0.0.0:1337
Eliza is ready and listening!
````
You can then connect via IRC on `localhost:6667` or
to the web frontend on [http://localhost:1337/](http://localhost:1337).
## Importing the module using Swift Package Manager
An example `Package.swift `importing the necessary modules:
```swift
// swift-tools-version:5.0
import PackageDescription
let package = Package(
name: "MyOwnIRCServer",
dependencies: [
.package(url: "https://github.com/NozeIO/swift-nio-irc-server.git",
from: "0.5.0")
],
targets: [
.target(name: "MyOwnIRCServer",
dependencies: [ "IRCServer" ])
]
)
```
### Who
Brought to you by
[ZeeZide](http://zeezide.de).
We like
[feedback](https://twitter.com/ar_institute),
GitHub stars,
cool [contract work](http://zeezide.com/en/services/services.html),
presumably any form of praise you can think of.
NIOIRC is a SwiftNIO port of the
[Noze.io miniirc](https://github.com/NozeIO/Noze.io/tree/master/Samples/miniirc)
example from 2016.