Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
name: c-sharp
version: "7.4.0"
version: "7.4.1"
schema: 1
scm: github.com/pubnub/c-sharp
changelog:
- date: 2025-07-30
version: v7.4.1
changes:
- type: bug
text: "Added MembershipMetadata container inside PNObjectEventResult to correctly parse and forward data when object event type is `membership`."
- type: bug
text: "Fixed issue where some result objects like PNMessageResult had UserMetadata declared as an object instead of the standard Dictionary<string, object> format for metadata."
- date: 2025-07-23
version: v7.4.0
changes:
Expand Down Expand Up @@ -929,7 +936,7 @@ features:
- QUERY-PARAM
supported-platforms:
-
version: Pubnub 'C#' 7.4.0
version: Pubnub 'C#' 7.4.1
platforms:
- Windows 10 and up
- Windows Server 2008 and up
Expand All @@ -940,7 +947,7 @@ supported-platforms:
- .Net Framework 4.6.1+
- .Net Framework 6.0
-
version: PubnubPCL 'C#' 7.4.0
version: PubnubPCL 'C#' 7.4.1
platforms:
- Xamarin.Android
- Xamarin.iOS
Expand All @@ -960,7 +967,7 @@ supported-platforms:
- .Net Core
- .Net 6.0
-
version: PubnubUWP 'C#' 7.4.0
version: PubnubUWP 'C#' 7.4.1
platforms:
- Windows Phone 10
- Universal Windows Apps
Expand All @@ -984,7 +991,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: Pubnub
location: https://github.com/pubnub/c-sharp/releases/tag/v7.4.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v7.4.1.0
requires:
-
name: ".Net"
Expand Down Expand Up @@ -1267,7 +1274,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: PubNubPCL
location: https://github.com/pubnub/c-sharp/releases/tag/v7.4.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v7.4.1.0
requires:
-
name: ".Net Core"
Expand Down Expand Up @@ -1626,7 +1633,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: PubnubUWP
location: https://github.com/pubnub/c-sharp/releases/tag/v7.4.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v7.4.1.0
requires:
-
name: "Universal Windows Platform Development"
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v7.4.1 - July 30 2025
-----------------------------
- Fixed: added MembershipMetadata container inside PNObjectEventResult to correctly parse and forward data when object event type is "membership".
- Fixed: fixed issue where some result objects like PNMessageResult had UserMetadata declared as an object instead of the standard Dictionary<string, object> format for metadata.

v7.4.0 - July 23 2025
-----------------------------
- Added: added support for `status` and `type` fields for uuid, channel and members app context apis.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public static T DeserializeToInternalObject<T>(IJsonPluggableLibrary jsonPlug, L

if (listObject[1] != null)
{
ack.UserMetadata = listObject[1];
ack.UserMetadata = jsonPlug.ConvertToDictionaryObject(listObject[1]);
}

if (ack.Event != null && ack.Event.ToLowerInvariant() == "interval")
Expand Down
2 changes: 1 addition & 1 deletion src/Api/PubnubApi/JsonDataParse/EventDeserializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private PNPresenceEventResult DeserializePresenceEvent(IDictionary<string, objec

if (jsonFields.TryGetValue("userMetadata", out object userMetadataValue))
{
presenceEvent.UserMetadata = userMetadataValue;
presenceEvent.UserMetadata = jsonLibrary.ConvertToDictionaryObject(userMetadataValue);
}

if (presenceEvent.Event != null && presenceEvent.Event.ToLowerInvariant() == "interval")
Expand Down
46 changes: 25 additions & 21 deletions src/Api/PubnubApi/JsonDataParse/PNObjectEventJsonDataParse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ internal static PNObjectEventResult GetObject(IJsonPluggableLibrary jsonPlug,
var dataFields = objectEventDicObj["data"] as Dictionary<string, object>;
if (dataFields != null)
{
//Common fields
var custom = dataFields.ContainsKey("custom") && dataFields["custom"] != null
? jsonPlug.ConvertToDictionaryObject(dataFields["custom"])
: null;
var status = GetStringValue(dataFields, "status");
var type = GetStringValue(dataFields, "type");
var updated = GetStringValue(dataFields, "updated");

if (result.Type?.ToLowerInvariant() == "uuid" && dataFields.ContainsKey("id"))
{
result.UuidMetadata = new PNUuidMetadataResult
Expand All @@ -46,12 +54,10 @@ internal static PNObjectEventResult GetObject(IJsonPluggableLibrary jsonPlug,
ExternalId = GetStringValue(dataFields, "externalId"),
ProfileUrl = GetStringValue(dataFields, "profileUrl"),
Email = GetStringValue(dataFields, "email"),
Status = GetStringValue(dataFields, "status"),
Type = GetStringValue(dataFields, "type"),
Custom = dataFields.ContainsKey("custom") && dataFields["custom"] != null
? jsonPlug.ConvertToDictionaryObject(dataFields["custom"])
: null,
Updated = GetStringValue(dataFields, "updated")
Status = status,
Type = type,
Custom = custom,
Updated = updated
};
}
else if (result.Type.ToLowerInvariant() == "channel" && dataFields.ContainsKey("id"))
Expand All @@ -61,33 +67,31 @@ internal static PNObjectEventResult GetObject(IJsonPluggableLibrary jsonPlug,
Channel = dataFields["id"]?.ToString(),
Name = GetStringValue(dataFields, "name"),
Description = GetStringValue(dataFields, "description"),
Status = GetStringValue(dataFields, "status"),
Type = GetStringValue(dataFields, "type"),
Custom = dataFields.ContainsKey("custom") && dataFields["custom"] != null
? jsonPlug.ConvertToDictionaryObject(dataFields["custom"])
: null,
Updated = GetStringValue(dataFields, "updated")
Status = status,
Type = type,
Custom = custom,
Updated = updated
};
}
else if (result.Type.ToLowerInvariant() == "membership" && dataFields.ContainsKey("uuid") &&
dataFields.ContainsKey("channel"))
{
result.MembershipMetadata = new PNMembershipMetadataResult()
{
Custom = custom,
Status = status,
Type = type,
Updated = updated
};
var userMetadataFields = dataFields["uuid"] as Dictionary<string, object>;
if (userMetadataFields != null && userMetadataFields.ContainsKey("id"))
{
result.UuidMetadata = new PNUuidMetadataResult
{
Uuid = userMetadataFields["id"]?.ToString()
};
result.MembershipMetadata.Uuid = userMetadataFields["id"]?.ToString();
}

var channelMetadataFields = dataFields["channel"] as Dictionary<string, object>;
if (channelMetadataFields != null && channelMetadataFields.ContainsKey("id"))
{
result.ChannelMetadata = new PNChannelMetadataResult
{
Channel = channelMetadataFields["id"]?.ToString()
};
result.MembershipMetadata.Channel = channelMetadataFields["id"]?.ToString();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Generic;

namespace PubnubApi
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Collections.Generic;

namespace PubnubApi;

public class PNMembershipMetadataResult
{
public string Channel { get; internal set; }
public string Uuid { get; internal set; }
public Dictionary<string, object> Custom { get; internal set; }
public string Status { get; internal set; }
public string Type { get; internal set; }
public string Updated { get; internal set; }
}
4 changes: 2 additions & 2 deletions src/Api/PubnubApi/Model/Consumer/Pubsub/PNMessageResult.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System.Collections.Generic;

namespace PubnubApi
{
Expand All @@ -10,7 +10,7 @@ public class PNMessageResult<T>
public long Timetoken { get; internal set; }

public string CustomMessageType { get; internal set; }
public object UserMetadata { get; internal set; }
public Dictionary<string, object> UserMetadata { get; internal set; }
public string Publisher { get; internal set; }
}
}
20 changes: 5 additions & 15 deletions src/Api/PubnubApi/Model/Consumer/Pubsub/PNObjectEventResult.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PubnubApi
namespace PubnubApi
{
public class PNObjectEventResult
{
public PNObjectEventResult()
{
this.Event = ""; //values = set/delete for uuid/channel/UuidAssociation/ChannelAssociation
this.Type = ""; //values = uuid/channel/membership
this.Channel = "";
}
public string Event { get; internal set; }
public string Type { get; internal set; }
public string Event { get; internal set; } = ""; //values = set/delete for uuid/channel/UuidAssociation/ChannelAssociation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

public string Type { get; internal set; } = ""; //values = uuid/channel/membership
public PNUuidMetadataResult UuidMetadata { get; internal set; } //Populate when Type = uuid
public PNChannelMetadataResult ChannelMetadata { get; internal set; } //Populate when Type = channel
public PNMembershipMetadataResult MembershipMetadata { get; internal set; } //Populate when Type = membership
public long Timestamp { get; internal set; }
public string Channel { get; internal set; } //Subscribed channel
public string Channel { get; internal set; } = ""; //Subscribed channel
public string Subscription { get; internal set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public PNPresenceEventResult()
public string Subscription { get; internal set; }

public long Timetoken { get; internal set; }
public object UserMetadata { get; internal set; }
public Dictionary<string, object> UserMetadata { get; internal set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

public string[] Join { get; internal set; }
public string[] Timeout { get; internal set; }
public string[] Leave { get; internal set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Api/PubnubApi/NewtonsoftJsonDotNet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ public T DeserializeToObject<T>(IDictionary<string, object> jsonFields)
if (jsonFields["userMetadata"] != null)
{
PropertyInfo userMetadataProp = specific.GetRuntimeProperty("UserMetadata");
userMetadataProp.SetValue(message, jsonFields["userMetadata"], null);
userMetadataProp.SetValue(message, ConvertToDictionaryObject(jsonFields["userMetadata"]), null);
}


Expand Down
4 changes: 2 additions & 2 deletions src/Api/PubnubApi/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
[assembly: AssemblyProduct("Pubnub C# SDK")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("7.4.0.0")]
[assembly: AssemblyFileVersion("7.4.0.0")]
[assembly: AssemblyVersion("7.4.1.0")]
[assembly: AssemblyFileVersion("7.4.1.0")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
Expand Down
5 changes: 3 additions & 2 deletions src/Api/PubnubApi/PubnubApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@

<PropertyGroup>
<PackageId>Pubnub</PackageId>
<PackageVersion>7.4.0.0</PackageVersion>
<PackageVersion>7.4.1.0</PackageVersion>
<Title>PubNub C# .NET - Web Data Push API</Title>
<Authors>Pandu Masabathula</Authors>
<Owners>PubNub</Owners>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
<PackageReleaseNotes>Added support for `status` and `type` fields for uuid, channel and members app context apis.</PackageReleaseNotes>
<PackageReleaseNotes>Added MembershipMetadata container inside PNObjectEventResult to correctly parse and forward data when object event type is `membership`.
Fixed issue where some result objects like PNMessageResult had UserMetadata declared as an object instead of the standard Dictionary format for metadata.</PackageReleaseNotes>
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
<!--<Summary>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Summary>-->
<Description>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Description>
Expand Down
8 changes: 6 additions & 2 deletions src/Api/PubnubApiPCL/PubnubApiPCL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@

<PropertyGroup>
<PackageId>PubnubPCL</PackageId>
<PackageVersion>7.4.0.0</PackageVersion>
<PackageVersion>7.4.1.0</PackageVersion>
<Title>PubNub C# .NET - Web Data Push API</Title>
<Authors>Pandu Masabathula</Authors>
<Owners>PubNub</Owners>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
<PackageReleaseNotes>Added support for `status` and `type` fields for uuid, channel and members app context apis.</PackageReleaseNotes>
<PackageReleaseNotes>Added MembershipMetadata container inside PNObjectEventResult to correctly parse and forward data when object event type is `membership`.
Fixed issue where some result objects like PNMessageResult had UserMetadata declared as an object instead of the standard Dictionary format for metadata.</PackageReleaseNotes>
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
<!--<Summary>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Summary>-->
<Description>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Description>
Expand Down Expand Up @@ -379,6 +380,9 @@
<Compile Include="..\PubnubApi\Model\Consumer\Objects\PNGetChannelMetadataResult.cs" Link="Model\Consumer\Objects\PNGetChannelMetadataResult.cs" />
<Compile Include="..\PubnubApi\Model\Consumer\Objects\PNGetUuidMetadataResult.cs" Link="Model\Consumer\Objects\PNGetUuidMetadataResult.cs" />
<Compile Include="..\PubnubApi\Model\Consumer\Objects\PNMembership.cs" Link="Model\Consumer\Objects\PNMembership.cs" />
<Compile Include="..\PubnubApi\Model\Consumer\Objects\PNMembershipMetadataResult.cs">
<Link>Model\Consumer\Objects\PNMembershipMetadataResult.cs</Link>
</Compile>
<Compile Include="..\PubnubApi\Model\Consumer\Objects\PNMembershipsItemResult.cs" Link="Model\Consumer\Objects\PNMembershipsItemResult.cs" />
<Compile Include="..\PubnubApi\Model\Consumer\Objects\PNMembershipsResult.cs" Link="Model\Consumer\Objects\PNMembershipsResult.cs" />
<Compile Include="..\PubnubApi\Model\Consumer\Objects\PNPage.cs" Link="Model\Consumer\Objects\PNPage.cs" />
Expand Down
8 changes: 6 additions & 2 deletions src/Api/PubnubApiUWP/PubnubApiUWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@

<PropertyGroup>
<PackageId>PubnubUWP</PackageId>
<PackageVersion>7.4.0.0</PackageVersion>
<PackageVersion>7.4.1.0</PackageVersion>
<Title>PubNub C# .NET - Web Data Push API</Title>
<Authors>Pandu Masabathula</Authors>
<Owners>PubNub</Owners>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
<PackageReleaseNotes>Added support for `status` and `type` fields for uuid, channel and members app context apis.</PackageReleaseNotes>
<PackageReleaseNotes>Added MembershipMetadata container inside PNObjectEventResult to correctly parse and forward data when object event type is `membership`.
Fixed issue where some result objects like PNMessageResult had UserMetadata declared as an object instead of the standard Dictionary format for metadata.</PackageReleaseNotes>
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
<!--<Summary>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Summary>-->
<Description>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Description>
Expand Down Expand Up @@ -508,6 +509,9 @@
<Compile Include="..\PubnubApi\Model\Consumer\Objects\PNGetChannelMetadataResult.cs" Link="Model\Consumer\Objects\PNGetChannelMetadataResult.cs" />
<Compile Include="..\PubnubApi\Model\Consumer\Objects\PNGetUuidMetadataResult.cs" Link="Model\Consumer\Objects\PNGetUuidMetadataResult.cs" />
<Compile Include="..\PubnubApi\Model\Consumer\Objects\PNMembership.cs" Link="Model\Consumer\Objects\PNMembership.cs" />
<Compile Include="..\PubnubApi\Model\Consumer\Objects\PNMembershipMetadataResult.cs">
<Link>Model\Consumer\Objects\PNMembershipMetadataResult.cs</Link>
</Compile>
<Compile Include="..\PubnubApi\Model\Consumer\Objects\PNMembershipsItemResult.cs" Link="Model\Consumer\Objects\PNMembershipsItemResult.cs" />
<Compile Include="..\PubnubApi\Model\Consumer\Objects\PNMembershipsResult.cs" Link="Model\Consumer\Objects\PNMembershipsResult.cs" />
<Compile Include="..\PubnubApi\Model\Consumer\Objects\PNPage.cs" Link="Model\Consumer\Objects\PNPage.cs" />
Expand Down
Loading
Loading