Skip to content

Commit

Permalink
メッセージを送信するクライアントを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Jan 25, 2024
1 parent d402379 commit d0237e2
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions tests/test_messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def on_message(label, data):
print("on_message", label, data)


def test_sendonly():
def send_message():
sora = sora_sdk.Sora()
connection = sora.create_connection(
signaling_urls=[os.environ.get("TEST_SIGNALING_URL")],
Expand All @@ -31,8 +31,32 @@ def test_sendonly():

connection.connect()

try:
while True:
time.sleep(1)
finally:
connection.disconnect()
time.sleep(3)

connection.send_data_channel("#spam", "ham")

connection.disconnect()


def test_messaging_direction_recvonly():
sora = sora_sdk.Sora()
connection = sora.create_connection(
signaling_urls=[os.environ.get("TEST_SIGNALING_URL")],
role="recvonly",
channel_id=os.environ.get("TEST_CHANNEL_ID_PREFIX") + "sora-python-sdk-test",
data_channel_signaling=True,
data_channels=[{"label": "#spam", "direction": "sendrecv"}],
audio=False,
video=False,
)

connection.on_data_channel = on_data_channel

# 次の行をコメントアウトすると SIGSEGV は発生しない
connection.on_message = on_message

connection.connect()

send_message()

connection.disconnect()

0 comments on commit d0237e2

Please sign in to comment.