ganache-cli can't return accounts info via websocket
return the accounts info of the ganache-cli server.
ganache-cli server crashed with the following stack:
TypeError: connection.reject is not a function
at WebSocketConnection.<anonymous> (C:\Users\shwj\AppData\Roaming\npm\node_modules\ganache-cli\node_modules\ganache-core\lib\webSocketServer.js:49:18)
at emitOne (events.js:116:13)
at WebSocketConnection.emit (events.js:211:7)
at WebSocketConnection.processFrame (C:\Users\shwj\AppData\Roaming\npm\node_modules\ganache-cli\node_modules\ganache-core\node_modules\websocket\lib\WebSocketConnection.js:529:26)
at C:\Users\shwj\AppData\Roaming\npm\node_modules\ganache-cli\node_modules\ganache-core\node_modules\websocket\lib\WebSocketConnection.js:321:40
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
Websocket request handler issue.
ganache-cli --account 0x0afd7091ee9e4dc73aa75ac00a4be3e5d1d475fa0c18d2b837372fe0ab2e392c,0xFFFFFFFFFFFFFFFFFF 0x96519d4e91b8c5056ac909fe19a6d6d58f45a9f03d31b7f2836c01af19a9a1d7,0xFFFFFFFFFFFFFFFFFF 0xd56a9fc3338826bb41e67b9975bd294833698de5800bc2377307800598458088,0xFFFFFFFFFFFFFFFFFF.
import web3
from web3 import Web3
from solc import compile_source
def main():
my_provider = Web3.WebsocketProvider('ws://127.0.0.1:8545')
w3 = Web3(my_provider)
print(w3.eth.accounts)
return
ganache-cli with infura.io under the same web3.py client . infrura.io can return the expected result whereas ganache-cli can't . I suppose it is a bug for ganache-cli.the ws client plugin in chrome , it worked:{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}
and got the correct result :

Thanks for reporting this, @ppLorins. I was able to reproduce the issue.
Two things are happening here:
We'll fix this by:
catch so it returns a proper jsonrpc 2.0 error response (with code: -32600) and a relevant error message.Thanks again
Proposed fix is here: https://github.com/trufflesuite/ganache-core/commit/7cb636fdaffebb21a7a817b033986cb187fe472f
TODO: add tests