check if onOpen is defined before calling onOpen; this fixes samples/swaggersocket-wordnik