Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enableSOCKSProxy - See websocket traffic in Charles proxy #423

Merged
merged 1 commit into from
Dec 8, 2017

Conversation

neoneye
Copy link
Contributor

@neoneye neoneye commented Nov 15, 2017

Here is a possible solution for #240

Usage

import Starscream

class AppSocket {
	private let url: URL

	private lazy var socket: WebSocket = {
		var request = URLRequest(url: self.url)
		request.timeoutInterval = 5
		let stream = FoundationStream()
		stream.enableSOCKSProxy = true
		let instance = WebSocket(request: request, protocols: ["coldwar_mad"], stream: stream)
		instance.delegate = self
		return instance
	}()

	init(url: URL) {
		self.url = url
	}

	func connect() {
		socket.connect()
	}
}

extension AppSocket: WebSocketDelegate {
	// ...
}

…to enable websocket inspection I applied the snippet by https://github.com/kevinmlong that is mentioned here: daltoniam#240
@daltoniam
Copy link
Owner

Looks good! Thanks.

@daltoniam daltoniam merged commit 06baac0 into daltoniam:master Dec 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants