Skip to content

Commit

Permalink
fix websocketservice and event streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamas Szucs committed Jun 5, 2023
1 parent 6059e7c commit 366727a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Assets/SuiUnitySDK/Plugins/UnityWebSocket/WebSocketService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private string ReturnSubscribeParameter(string eventFilterString)
{
if (_socket is null) return null;

var parameterToSend = "{\"jsonrpc\":\"2.0\", \"id\": 1, \"method\": \"sui_subscribeEvent\", \"params\": [" + eventFilterString + "]}";
var parameterToSend = "{\"jsonrpc\":\"2.0\", \"id\": 1, \"method\": \"suix_subscribeEvent\", \"params\": [" + eventFilterString + "]}";
return parameterToSend;
}

Expand All @@ -124,7 +124,7 @@ private string ReturnUnsubscribeParameter(ulong streamId)
{
if (_socket is null) return null;

var unsubscribeParameter = "{\"jsonrpc\":\"2.0\", \"id\":1, \"method\":\"sui_unsubscribeEvent\", \"params\":[" + streamId + "]}";
var unsubscribeParameter = "{\"jsonrpc\":\"2.0\", \"id\":1, \"method\":\"suix_unsubscribeEvent\", \"params\":[" + streamId + "]}";
return unsubscribeParameter;
}
}
Expand Down
5 changes: 3 additions & 2 deletions Assets/SuiUnitySDK/Scripts/UnityWebSocket/SuiEventStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class SuiEventStream : MonoBehaviour

public bool autoConnectOnStartup = true;

private const string WebsocketEndpoint = "wss://fullnode.devnet.sui.io:443";
private const string WebsocketEndpoint = "wss://fullnode.testnet.sui.io:443";

public virtual void Awake()
{
Expand All @@ -24,7 +24,8 @@ public virtual void Start()
{
if (autoConnectOnStartup)
{
_webSocketService.SubscribeToEvents("{\"MoveEventType\":\"0x2::devnet_nft::MintNFTEvent\"}");
var filterJson = "{\"MoveModule\":{\"module\":\"clob\",\"package\":\"0x8da36ef392a7d2b1e7dac2a987767eea5a415d843d3d34cb66bec6434001f931\"}}";
_webSocketService.SubscribeToEvents(filterJson);
}
}

Expand Down

0 comments on commit 366727a

Please sign in to comment.