

def send_pack(self, message, binary=False):
    if binary:
        raise Exception('binary not supported for JSONPTransport')
    self.active = False
    try:
        msg = ('%s(%s);\r\n' % (self.callback, proto.json_encode(message)))
        self.set_header('Content-Type', 'application/javascript; charset=UTF-8')
        self.set_header('Content-Length', len(msg))
        self.set_header('Etag', 'dummy')
        self.write(msg)
        self.flush(callback=self.send_complete)
    except IOError:
        self.session.delayed_close()

dataset/ETHPy150Open benoitc/gaffer/gaffer/sockjs/transports/jsonp.py JSONPTransport.send_pack/original