Giter Site home page Giter Site logo

clusterws / clusterws-client-swift Goto Github PK

View Code? Open in Web Editor NEW
20.0 4.0 7.0 328 KB

☄️ Swift Client for ClusterWS - lightweight, fast and powerful framework for building scalable WebSockets applications in Node.js.

License: MIT License

Swift 99.05% Ruby 0.95%
cluster ios websocket socket client minimalistic realtime swift-4 node-cluster client-swift

clusterws-client-swift's Introduction

ClusterWS Swift Client

Build Scalable Node.js WebSockets Applications

Official Swift Client library for ClusterWS - lightweight, fast and powerful framework for building scalable WebSockets applications in Node.js.

Find more about ClusterWS Swift Client in Wiki Documentation

clusterws-client-swift's People

Contributors

cemck avatar muhrifqii avatar romanbaitaliuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

clusterws-client-swift's Issues

Support Swift 4.2

Submitting

  • Bug
  • Question
  • Suggetion
  • Other

Details

Any plans for supporting Swift 4.2 and xcode 10?

JSONStringConversionError("9")

Submitting

  • Bug
  • Question
  • Suggetion
  • Other

Details

Hi i'm getting this error in the XCode console after a few seconds it did connect to the server:
"JSON string conversion error: The data couldn’t be read because it isn’t in the correct format."
ERROR JSONStringConversionError("9")

After that the client disconnects from server. Don't know if this is a bug or i did a mistake
I'm running clusterws 3.0.6 on macOS 10.13.4, node.js v8.11.2 and XCode 9.3.1 with iOS 11.3

This is the client code:

import UIKit
import ClusterWS_Client_Swift

class ViewController: UIViewController, CWSDelegate {

    let webSocket = ClusterWS(url: "ws://localhost:3003")
    
    @IBAction func connectButtonTapped(_ sender: UIButton) {
        webSocket.connect()
    }
    
    @IBAction func disconnectButtonTapped(_ sender: UIButton) {
        webSocket.disconnect()
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        webSocket.delegate = self
    }
    
    func onConnect() {
        print("CONNECTED")
    }
    
    func onDisconnect(code: Int?, reason: String?) {
        print("DISCONNECTED", code, reason)
    }
    
    func onError(error: Error) {
        print("ERROR", error)
    }
    
}

This is the server code:

// Import clusterws
const ClusterWS = require('clusterws')

// Import your library/framework
const express = require('express')

// Configure ClusterWS
const clusterws = new ClusterWS({
    worker: Worker, // Worker function must be provided
    port: 3003
})

// Worker function with all your server logic
function Worker() { 
    // Get websocket server
    const wss = this.wss
    // Get http/https server
    const server = this.server 

    // Use your library/framework as you usually do
    const app = express()
    app.get('/home', (req, res, next) => {})

    // Connect ClusterWS and your library/framework 
    server.on('request', app)

    // Listen on WebSocket connection
    wss.on('connection', (socket) => {
        console.log('Connected to ws')
    })
}

Removing emitter event handler

Submitting

  • Bug
  • Question
  • Suggetion
  • Other

Details

Is there any way to remove emitter event? Let's say I have a strong reference on particular event that needed to be removed. CWSEmitter doesn't have function for removing an event. Current workaround is to set some clossure to overwrite it using on function.

Addition:
I can't call CWSEmitter.removeAllEvents from ClusterWS instance

Is really iOS 11 minimum version?

  • Bug
  • Question
  • Suggetion
  • Other

Hi when I try to use this with CocoaPods I got an error

Specs satisfying the ClusterWS-Client-Swift dependency were found, but they required a higher minimum deployment target.

I see into source code and I found that the target version is for iOS 11, but my app must be compatible from 9.0 iOS version.
I really required iOS 11 version?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.