parameters: (self, message, end=True, binary=False)
docstring: Override Stream.send_message.
docstring_summary: Override Stream.send_message.
docstring_tokens: Override Stream . send_message .
function: def send_message(self, message, end=True, binary=False):
          """Override Stream.send_message."""
  
          if self._request.server_terminated:
              raise BadOperationException(
                  'Requested send_message after sending out a closing handshake')
  
          if binary and isinstance(message, unicode):
              raise BadOperationException(
                  'Message for binary frame must be instance of str')
  
          if binary:
              opcode = common.OPCODE_BINARY
          else:
              opcode = common.OPCODE_TEXT
              message = message.encode('utf-8')
  
          for message_filter in self._options.outgoing_message_filters:
              message = message_filter.filter(message, end, binary)
  
          if self._last_message_was_fragmented:
              if opcode != self._message_opcode:
                  raise BadOperationException('Message types are different in '
                                              'frames for the same message')
              opcode = common.OPCODE_CONTINUATION
          else:
              self._message_opcode = opcode
  
          self._write_inner_frame(opcode, message, end)
          self._last_message_was_fragmented = not end
function_tokens: def send_message ( self , message , end = True , binary = False ) : if self . _request . server_terminated : raise BadOperationException ( 'Requested send_message after sending out a closing handshake' ) if binary and isinstance ( message , unicode ) : raise BadOperationException ( 'Message for binary frame must be instance of str' ) if binary : opcode = common . OPCODE_BINARY else : opcode = common . OPCODE_TEXT message = message . encode ( 'utf-8' ) for message_filter in self . _options . outgoing_message_filters : message = message_filter . filter ( message , end , binary ) if self . _last_message_was_fragmented : if opcode != self . _message_opcode : raise BadOperationException ( 'Message types are different in ' 'frames for the same message' ) opcode = common . OPCODE_CONTINUATION else : self . _message_opcode = opcode self . _write_inner_frame ( opcode , message , end ) self . _last_message_was_fragmented = not end