// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #pragma once // React Native Windows #include // Standard Library #include #include namespace Microsoft::React { /// /// See https://github.com/facebook/react-native/blob/v0.63.2/React/CoreModules/RCTWebSocketModule.h#L12 /// struct IWebSocketModuleContentHandler { virtual ~IWebSocketModuleContentHandler() noexcept {} /// Returns true if this handler should process messages for the given socket. virtual bool CanHandleSocket(int64_t socketId) noexcept = 0; virtual void ProcessMessage(std::string &&message, winrt::Microsoft::ReactNative::JSValueObject ¶ms) noexcept = 0; virtual void ProcessMessage( std::vector &&message, winrt::Microsoft::ReactNative::JSValueObject ¶ms) noexcept = 0; /// Check CanHandleSocket() then ProcessMessage() in one call. /// Returns true if the message was handled. virtual bool TryProcessMessage( int64_t socketId, std::string &&message, winrt::Microsoft::ReactNative::JSValueObject ¶ms) noexcept = 0; virtual bool TryProcessMessage( int64_t socketId, std::vector &&message, winrt::Microsoft::ReactNative::JSValueObject ¶ms) noexcept = 0; }; } // namespace Microsoft::React