Skip to content

Commit

Permalink
export opcode to SocketIOUser send method to support send binary and …
Browse files Browse the repository at this point in the history
…other format data
  • Loading branch information
yanhaicheng committed Nov 22, 2023
1 parent 2f2749a commit c9933ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions locust_plugins/users/socketio.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def receive_loop(self):
logging.debug(f"WSR: {message}")
self.on_message(message)

def send(self, body, name=None, context={}):
def send(self, body, name=None, context={}, opcode=websocket.ABNF.OPCODE_TEXT):
if not name:
if body == "2":
name = "2 heartbeat"
Expand All @@ -112,7 +112,7 @@ def send(self, body, name=None, context={}):
context={**self.context(), **context},
)
logging.debug(f"WSS: {body}")
self.ws.send(body)
self.ws.send(body, opcode)

def sleep_with_heartbeat(self, seconds):
while seconds >= 0:
Expand Down

0 comments on commit c9933ff

Please sign in to comment.