Add faqs page
This commit is contained in:
parent
54c2b3bd35
commit
0d14294d79
@ -57,6 +57,9 @@ SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{
|
|||||||
- Supports TLS/SSL
|
- Supports TLS/SSL
|
||||||
- Can be used from Objective-C
|
- Can be used from Objective-C
|
||||||
|
|
||||||
|
## FAQS
|
||||||
|
Checkout the [FAQs](https://nuclearace.github.io/Socket.IO-Client-Swift/FAQS.html) for commonly asked questions.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
Requires Swift 3/Xcode 8.x
|
Requires Swift 3/Xcode 8.x
|
||||||
|
|
||||||
|
|||||||
@ -241,6 +241,7 @@
|
|||||||
74DA217D1F0945E9009C19EE /* libcommonCrypto.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libcommonCrypto.tbd; path = usr/lib/system/libcommonCrypto.tbd; sourceTree = SDKROOT; };
|
74DA217D1F0945E9009C19EE /* libcommonCrypto.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libcommonCrypto.tbd; path = usr/lib/system/libcommonCrypto.tbd; sourceTree = SDKROOT; };
|
||||||
74F124EF1BC574CF002966F4 /* SocketBasicPacketTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketBasicPacketTest.swift; sourceTree = "<group>"; };
|
74F124EF1BC574CF002966F4 /* SocketBasicPacketTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SocketBasicPacketTest.swift; sourceTree = "<group>"; };
|
||||||
CEBA56991CDA0B8200BA0389 /* SocketExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketExtensions.swift; path = Source/SocketExtensions.swift; sourceTree = "<group>"; };
|
CEBA56991CDA0B8200BA0389 /* SocketExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SocketExtensions.swift; path = Source/SocketExtensions.swift; sourceTree = "<group>"; };
|
||||||
|
DD52BA265A22022906AF006D /* FAQ.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = FAQ.md; path = "Usage Docs/FAQ.md"; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@ -309,6 +310,7 @@
|
|||||||
572EF2391B51F18A00EEBB58 /* SocketIO-Mac */,
|
572EF2391B51F18A00EEBB58 /* SocketIO-Mac */,
|
||||||
572EF2461B51F18A00EEBB58 /* SocketIO-MacTests */,
|
572EF2461B51F18A00EEBB58 /* SocketIO-MacTests */,
|
||||||
5764DF7B1B51F24A004FF46E /* Source */,
|
5764DF7B1B51F24A004FF46E /* Source */,
|
||||||
|
DD52BA265A22022906AF006D /* FAQ.md */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
|||||||
44
Usage Docs/FAQ.md
Normal file
44
Usage Docs/FAQ.md
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
## How do I connect to my WebSocket server?
|
||||||
|
|
||||||
|
This library is **NOT** a WebSockets library. This library is only for servers that implement the socket.io protocol,
|
||||||
|
such as [socket.io](https://socket.io/). If you need a plain WebSockets client check out
|
||||||
|
[Starscream](https://github.com/daltoniam/Starscream) for Swift and [JetFire](https://github.com/acmacalister/jetfire)
|
||||||
|
for Objective-C.
|
||||||
|
|
||||||
|
## Why isn't my event handler being called?
|
||||||
|
|
||||||
|
One of the most common reasons your event might not be called is if the client is released by
|
||||||
|
[ARC](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/AutomaticReferenceCounting.html).
|
||||||
|
|
||||||
|
Take this code for example:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
class SocketManager {
|
||||||
|
func addHandlers() {
|
||||||
|
let socket = SocketIOClient(socketURL: "http://somesocketioserver.com")
|
||||||
|
|
||||||
|
socket.on("myEvent") {data, ack in
|
||||||
|
print(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This code is **incorrect**, and the event handler will never be called. Because as soon as this method is called `socket`
|
||||||
|
will be released and its memory reclaimed.
|
||||||
|
|
||||||
|
A correct way would be:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
class SocketManager {
|
||||||
|
let socket = SocketIOClient(socketURL: "http://somesocketioserver.com")
|
||||||
|
|
||||||
|
func addHandlers() {
|
||||||
|
socket.on("myEvent") {data, ack in
|
||||||
|
print(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
Loading…
x
Reference in New Issue
Block a user