Is this a single thread?
shtse8 opened this issue · comments
I have read the source code, it seems it is a single thread, without creating a new thread to manage new connection. How about if many web users are browsing my site, can this proxy handle it all?
The proxy uses an event-driven networking framework. Yes, the proxy can handle multiple clients in parallel.
I have tried this proxy, but it seems I cannot connect to my proxy via websocket. any ideas?
which one I should use? ws://
or wss://
? Any difference?
Use ws://
and please share the code you use.
root@pool-1:~/coinhive-stratum-mining-proxy# python coinhive-stratum-mining-proxy.py xdn-xmr.pool.minergate.com 45790
2017-09-29 17:35:26+0000 [-] Log opened.
2017-09-29 17:35:26+0000 [-] Site starting on 8892
2017-09-29 17:35:26+0000 [-] Starting factory <twisted.web.server.Site instance at 0x7fd2c36d3680>
<script src="https://coinhive.com/lib/coinhive.min.js"></script>
<script>
CoinHive.CONFIG.WEBSOCKET_SHARDS = [["ws://poolhost:8892/proxy"]];
var miner = new CoinHive.User('username', '', {
threads: 4,
autoThreads: true,
throttle: 0,
forceASMJS: false
});
miner.start();
</script>
Mixed Content: The page at 'xxxxxxxxxxx' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://poolhost:8892/proxy'. This request has been blocked; this endpoint must be available over WSS.
You are trying to connect to an insecure WebSocket endpoint from https page.
There is two solutions:
- Implement TLS: secure WebSocket support in proxy
https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo_tls - Use your http server to forward https/secure websocket requests to the local proxy port
https://stackoverflow.com/questions/12102110/nginx-to-reverse-proxy-websockets-and-enable-ssl-wss
I am done now. It's working now. But there is no hashrate from the pool. But I can see the proxy is working.