Skip to content

Commit

Permalink
Fixing some warnings and updating README
Browse files Browse the repository at this point in the history
  • Loading branch information
Yossi Abraham committed Sep 7, 2016
1 parent ae781d6 commit 33a0c64
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 20 deletions.
54 changes: 38 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,52 @@
# Swamp - Swift WAMP implementation
## Swamp - Swift WAMP implementation

[![CI Status](http://img.shields.io/travis/Yossi Abraham/Swamp.svg?style=flat)](https://travis-ci.org/Yossi Abraham/Swamp)
[![Version](https://img.shields.io/cocoapods/v/Swamp.svg?style=flat)](http://cocoapods.org/pods/Swamp)
[![License](https://img.shields.io/cocoapods/l/Swamp.svg?style=flat)](http://cocoapods.org/pods/Swamp)
[![Platform](https://img.shields.io/cocoapods/p/Swamp.svg?style=flat)](http://cocoapods.org/pods/Swamp)
Swamp is a WAMP implementation in Swift.

## Example
It currently supports calling remote procedures, subscribing on topics, and publishing events. It also supports challenge-response authentication using tickets & CRA authentication.

To run the example project, clone the repo, and run `pod install` from the Example directory first.
Swamp `0.1.0` utilizes WebSockets as it's only available transport, and JSON as it's serialization method.

## Requirements
Contributions to support MessagePack & Raw Sockets will be merged gladly!

## Requirements
iOS 8.0 or OSX 10.9

## Installation
Swamp is not yet available through cocoapods. YET. Please clone it and build by yourself.

## Usage
Will be documented soon, for now check the [CrossbarIntegrationTests.swift](Example/Tests/CrossbarIntegrationTests.swift) file you lazy dog.

## Testing
For now, only integration tests against crossbar exists. I am planning to add unit tests in the future.

In order to run the tests:

1. Install [Docker for Mac](https://docs.docker.com/engine/installation/mac/) (Easy Peasy)
2. Open `Example/Swamp.xcworkspace` with XCode
3. Select `Swamp_Test-iOS` or `Swamp_Test-OSX`
4. Run the tests! (`Product -> Test` or ⌘U)

### Troubleshooting
If for some reason the tests fail, make sure:

* You have docker installed and available at `/usr/local/bin/docker`
* You have an available port 8080 on your machine

Swamp is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
You can also inspect `Example/swamp-crossbar-instance.log` to find out what happened with the crossbar instance while the tests were executing.

```ruby
pod "Swamp"
```
## Roadmap
1. MessagePack & Raw Sockets
2. Callee role
3. More robust codebase and error handling
4. More generic and comfortable API
5. Advanced profile features

## Author
## Authors

Yossi Abraham, yo.ab@outlook.com
- Yossi Abraham, yo.ab@outlook.com.
- You?

## License

Swamp is available under the MIT license. See the LICENSE file for more info.
I don't care, MIT because it's `pod lib create` default and I'm too lazy to [tldrlegal](https://tldrlegal.com).
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PublishedSwampMessage: SwampMessage {
}

func marshal() -> [AnyObject] {
var marshalled: [AnyObject] = [SwampMessages.Published.rawValue, self.requestId, self.publication]
let marshalled: [AnyObject] = [SwampMessages.Published.rawValue, self.requestId, self.publication]
return marshalled
}
}
7 changes: 4 additions & 3 deletions Swamp/SwampSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public class SwampSession: SwampTransportDelegate {
self.sendMessage(AuthenticateSwampMessage(signature: authResponse, extra: [:]))
} else {
print("There was no delegate, aborting.")
try! self.abort()
self.abort()
}
// MARK: Session responses
case let message as WelcomeSwampMessage:
Expand Down Expand Up @@ -311,7 +311,7 @@ public class SwampSession: SwampTransportDelegate {
case let message as ErrorSwampMessage:
switch message.requestType {
case SwampMessages.Call:
if let (callback, errorCallback) = self.callRequests.removeValueForKey(message.requestId) {
if let (_, errorCallback) = self.callRequests.removeValueForKey(message.requestId) {
errorCallback(details: message.details, error: message.error, args: message.args, kwargs: message.kwargs)
} else {
// TODO: log this erroneous situation
Expand Down Expand Up @@ -359,6 +359,7 @@ public class SwampSession: SwampTransportDelegate {
}

private func generateRequestId() -> Int {
return self.currRequestId++
self.currRequestId += 1
return self.currRequestId
}
}

0 comments on commit 33a0c64

Please sign in to comment.