Fix bugs that OnConnect and OnDisconnect are not triggered
Merge pull request #33 from cowboy129/master

Fix bugs that OnConnect and OnDisconnect are not triggered