Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
Signed-off-by: Jarema <melgaer@gmail.com>
  • Loading branch information
Jarema committed Oct 18, 2023
1 parent 4a6ee8d commit 1958672
Showing 1 changed file with 30 additions and 25 deletions.
55 changes: 30 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# SwiftyNats
A maintained swift client for interacting with a [nats](http://nats.io) server based on NIO2.
<p align="center">
<img src="./Resources/Logo@256.png">
</p>

![SwiftyNats Logo](./Resources/Logo@256.png)
<p align="center">
A <a href="https://www.swift.org">Swift</a> client for the <a href="https://nats.io">NATS messaging system</a>.
</p>

**:warning: WARNING: THIS REPOSITORY IS UNDER REWORK AND SHOULD NOT BE USED AT THE MOMENT :warning: **

Tested with Swift 5.4 on [![macos](https://github.com/aus-der-Technik/swifty-nats/actions/workflows/macos.yml/badge.svg?branch=main)](https://github.com/aus-der-Technik/swifty-nats/actions/workflows/macos.yml) and [![Linux](https://github.com/aus-der-Technik/swifty-nats/actions/workflows/linux.yml/badge.svg?branch=main)](https://github.com/aus-der-Technik/swifty-nats/actions/workflows/linux.yml)

Expand All @@ -10,8 +15,8 @@ Swift Version Compatibility: [![](https://img.shields.io/endpoint?url=https%3A%2
Platform Compatibility: [![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Faus-der-Technik%2Fswifty-nats%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/aus-der-Technik/swifty-nats)

## Support
Join the [#swift](https://natsio.slack.com/archives/C02D41BU0PQ) channel on nats.io Slack.
We'll do our best to help quickly. You can also just drop by and say hello. We're looking forward to developing the community.
Join the [#swift](https://natsio.slack.com/archives/C02D41BU0PQ) channel on nats.io Slack.
We'll do our best to help quickly. You can also just drop by and say hello. We're looking forward to developing the community.

## Installation via Swift Package Manager
### In Package.swift
Expand Down Expand Up @@ -40,8 +45,8 @@ let package = Package(

```
### In an .xcodeproj
Open the project inspector in XCode and select your project. It is importent to select the **project** and not a target!
Klick on the third tab `Package Dependencies` and add the git url `https://github.com/aus-der-technik/SwiftyNats.git` by selecting the litte `+`-sign at the end of the package list.
Open the project inspector in XCode and select your project. It is importent to select the **project** and not a target!
Klick on the third tab `Package Dependencies` and add the git url `https://github.com/aus-der-technik/SwiftyNats.git` by selecting the litte `+`-sign at the end of the package list.


## Basic Usage
Expand All @@ -57,10 +62,10 @@ client.on(.connect) { _ in
print("Client connected")
}

// try to connect to the server
// try to connect to the server
try? client.connect()

// subscribe to a channel with a inline message handler.
// subscribe to a channel with a inline message handler.
client.subscribe("foo.bar") { message in
print("payload: \(message.payload)")
print("size: \(message.byteCount)")
Expand All @@ -83,8 +88,8 @@ client.config.loglevel = .info
```

### Reconnection is up to you
Reconnection is not part of this package, because if a server diconnects your application have to be sure that
subscribtions are made up again correctly.
Reconnection is not part of this package, because if a server diconnects your application have to be sure that
subscribtions are made up again correctly.

With SwiftyNats this is a very easy step:

Expand All @@ -93,7 +98,7 @@ With SwiftyNats this is a very easy step:
// register a new client
let client = NatsClient(url)

// listen to the .disconnected event to try a reconnect
// listen to the .disconnected event to try a reconnect
client.on(.disconnected) { [self] _ in
sleep(5);
try? client.reconnect()
Expand All @@ -116,11 +121,11 @@ The public class `NatsEvent` contains all events you can subscribt to.

| event | description |
| ------------ | ---------------------------------------------------------------------- |
| connected | The client is conected to the server. |
| disconnected | The client disconnects and was connectd before. |
| connected | The client is conected to the server. |
| disconnected | The client disconnects and was connectd before. |
| response | The client gets an response from the server (internal). |
| error | The server sends an error that can't be handled. |
| dropped | The clients droped a message. Mostly because of queue length to short. |
| dropped | The clients droped a message. Mostly because of queue length to short. |
| reconnecting | The client reconencts to the server, (Because of a called reconnect()).|
| informed | The server sends his information data successfully to the client. |

Expand All @@ -138,7 +143,6 @@ print("\(client.serverInformation.serverName) has Version: \(client.serverInform
## Contribution
Contribution is always welcome. Just send me a pull request.


# Changelog

## 2.2.0
Expand All @@ -152,32 +156,33 @@ Contribution is always welcome. Just send me a pull request.
- Subscription queue is an optional property of NatsSubject

## 2.1.1
- rewrite the ChannelHandler: remove a bug that could lead into dropped messages.
- rewrite the ChannelHandler: remove a bug that could lead into dropped messages.

## 2.1.0
- uses NIO2
- uses NIO2
- works with Vapor, now!

## 2.0.3
- supports iOS anf tvOS

## 2.0.2
- Get information from the connected Server (Version, name, id, ...)

## 2.0.1
- Test with GitHub Actions
## 2.0.1
- Test with GitHub Actions
- Update Dockerfile to build and test on Swift 5.4 (Linux)
- Test with a real NATS-Server on macos
- Cleanup unused definitions
- Update Informations, do project care

## 2.0.0
## 2.0.0
- Tested with NATS 2.3.4
- Introduced logging
- Updated depricated functions
- Updated depricated functions

# Roadmap
See: Contribution ;)
See: Contribution ;)
- Propper function description is needed


# Attribution
This library is based on excellent work in https://github.com/aus-der-Technik/SwiftyNats

0 comments on commit 1958672

Please sign in to comment.