GithubHelp home page GithubHelp logo

mirek / corewebsocket Goto Github PK

View Code? Open in Web Editor NEW
142.0 142.0 34.0 189 KB

Web Socket Server and Client Library for iOS and OSX. Follows Core Foundation API style.

Home Page: http://en.wikipedia.org/wiki/WebSockets

C++ 2.15% C 79.92% Objective-C 17.93%

corewebsocket's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

corewebsocket's Issues

broken pipe issue - messages not sent in Mac OS X 10.6.8 (SL)

I have been running the CoreWebSocketConsole example with the test.html client without any issues in receiving or sending messages on my development machine (Mac OS X 10.9).

However, recently when I tested it on another machine based on Mac OS X 10.6.8 (Snow Leopard), only incoming messages were received, but none of the outgoing messages were sent successfully to the test client.

A 'kCFStreamEventErrorOccurred' event is received by __WebSocketClientWriteCallBack followed by a console message that says:
' kCFStreamEventErrorOccurred (write) '
' Error Domain=NSPOSIXErrorDomain Code=32 UserInfo=0x501300 "The operation couldn't be completed. Broken pipe" '

Running Error

clang: error: linker command failed with exit code 1 (use -v to see invocation)
Ld /Users/lv/Library/Developer/Xcode/DerivedData/mySocket-eejbwkwzhnjjjkaekcmqfajzpkjk/Build/Products/Debug/CoreWebSocket.framework/Versions/A/CoreWebSocket normal x86_64
cd /Volumes/Works/MySocket/mySocket/CoreWebSocket
export MACOSX_DEPLOYMENT_TARGET=10.6
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -L/Users/lv/Library/Developer/Xcode/DerivedData/mySocket-eejbwkwzhnjjjkaekcmqfajzpkjk/Build/Products/Debug -F/Users/lv/Library/Developer/Xcode/DerivedData/mySocket-eejbwkwzhnjjjkaekcmqfajzpkjk/Build/Products/Debug -filelist /Users/lv/Library/Developer/Xcode/DerivedData/mySocket-eejbwkwzhnjjjkaekcmqfajzpkjk/Build/Intermediates/CoreWebSocket.build/Debug/CoreWebSocket.build/Objects-normal/x86_64/CoreWebSocket.LinkFileList -install_name /Library/Frameworks/CoreWebSocket.framework/Versions/A/CoreWebSocket -mmacosx-version-min=10.6 -Xlinker -no_deduplicate -framework CoreFoundation -framework CoreServices -lcrypto -single_module -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/lv/Library/Developer/Xcode/DerivedData/mySocket-eejbwkwzhnjjjkaekcmqfajzpkjk/Build/Intermediates/CoreWebSocket.build/Debug/CoreWebSocket.build/Objects-normal/x86_64/CoreWebSocket_dependency_info.dat -o /Users/lv/Library/Developer/Xcode/DerivedData/mySocket-eejbwkwzhnjjjkaekcmqfajzpkjk/Build/Products/Debug/CoreWebSocket.framework/Versions/A/CoreWebSocket
duplicate symbol ___WebSocketFrameOpCodeCString in:
/Users/lv/Library/Developer/Xcode/DerivedData/mySocket-eejbwkwzhnjjjkaekcmqfajzpkjk/Build/Intermediates/CoreWebSocket.build/Debug/CoreWebSocket.build/Objects-normal/x86_64/WebSocket.o
/Users/lv/Library/Developer/Xcode/DerivedData/mySocket-eejbwkwzhnjjjkaekcmqfajzpkjk/Build/Intermediates/CoreWebSocket.build/Debug/CoreWebSocket.build/Objects-normal/x86_64/WebSocketClient.o
duplicate symbol ___WebSocketFrameOpCodeCString in:
/Users/lv/Library/Developer/Xcode/DerivedData/mySocket-eejbwkwzhnjjjkaekcmqfajzpkjk/Build/Intermediates/CoreWebSocket.build/Debug/CoreWebSocket.build/Objects-normal/x86_64/WebSocket.o
/Users/lv/Library/Developer/Xcode/DerivedData/mySocket-eejbwkwzhnjjjkaekcmqfajzpkjk/Build/Intermediates/CoreWebSocket.build/Debug/CoreWebSocket.build/Objects-normal/x86_64/WebSocketFrame.o
ld: 2 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I did follow your instructions step by step.
But I can't run my app with this library.
MacOS 10.12, Xcode 7.3
Hope you guide me.

Add WebSocket client examples

I'm currently working on a project that needs to communicate with a WebSocket server. I've looked at the example in the Readme.md file and in main.c but they both seem to be examples for creating a WebSocket listening server and not for setting up a WebSocket client.

After browsing through the headers, it seems that I need to provide a CFSocketNativeHandle object to the creation function WebSocketClientCreate. I'm having trouble understanding what is needed to provide the CFSocketNativeHandle object. I was hoping someone could shed some light on this problem, and also help future users of CoreWebSocket who also want to implement a client. Thanks!

WebSockets connection won't close.

Using https://www.websocket.org/echo.html and running the example on my MacBook Pro, the connection will refuse to close.

AppDelegate.m:

#import "AppDelegate.h"
#include "CoreWebSocket/CoreWebSocket.h"

@interface AppDelegate ()

@property (weak) IBOutlet NSWindow *window;
@end

@implementation AppDelegate

 void Callback(WebSocketRef self, WebSocketClientRef client, CFStringRef value) {
    if (value) {
        CFShow(value);
        WebSocketWriteWithString(self, CFSTR("hello!"));
    }
}

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    // Insert code here to initialize your application
    WebSocketRef webSocket = WebSocketCreateWithHostAndPort(NULL, kWebSocketHostAny,     6001, NULL);
    if (webSocket) {
        webSocket->callbacks.didClientReadCallback = Callback;
    }
}

- (void)applicationWillTerminate:(NSNotification *)aNotification {
    // Insert code here to tear down your application
}

@end

I tried, and the callback willRemoveClientCallback is not called. Any help with this?

Alex.

Add Podfile support

It was easier to create a podfile than integrate through xcode. Pull request soon.

CoreWebSocket Vs. SocketRocket

In the README.md explain the pros & cons of using CoreWebSocket as compared to other libraries, such as SocketRocket.

Reference loop

WebSocketRelease() method doesn't release because WebSocketClients retain WebSocket. WebSocket retains WebSocketClients as well.
Proposed workaround:
for (CFIndex i = 0; i < WebSocketGetClientCount(self.webSocket); ++i) { WebSocketRelease(self.webSocket); }

Doesn't appear to handle message fragmentation

Large messages are received, but WebSocketFrameParse seems to only handle the first frame resulting in truncation.

It appears there was a previous attempt to fix that was reverted. Any chance this could get fixed?

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.