Added callbacks for onOpen and onClose

New lines 65-66, 117-119, 156-158, 197-198, 219-220
Merge pull request #73 from brycesteinhoff/master

Added callbacks for onOpen and onClose