Disable TLS
Disable TLS when you need to capture unencrypted TCP traffic for debugging in a development environment. PubNub SDKs connect over TLS 1.2 by default, except the Lua SDK and the unsupported Twisted SDK, where you set ssl to true. It should stay enabled in production.
Before you start
Confirm you have:
- A PubNub keyset with publish and subscribe keys from Admin Portal.
- A development or testing environment. Do not disable TLS in production.
SSL parameter name
Some PubNub SDKs use ssl as the parameter name. This is a legacy name for TLS. SSL v3 was deprecated after a security vulnerability and replaced by TLS, but the parameter name was not updated in all SDKs.
Disable TLS in SDK initialization
Set the TLS/SSL configuration option to false when creating the PubNub instance.
- JavaScript
- Swift
- Objective-C
- Java
- C#
- Python
1var pubnub = new PubNub({
2 subscribeKey: "mySubscribeKey",
3 publishKey: "myPublishKey",
4 userId: "myUniqueUserId",
5 ssl: false // default 'true'
6});
1import PubNubSDK
2
3let config = PubNubConfiguration(
4 publishKey: "demo",
5 subscribeKey: "demo",
6 userId: "myUniqueUserId",
7 useSecureConnections: false // default true
8)
9
10let pubnub = PubNub(configuration: config)
1PNConfiguration *pnconfig = [PNConfiguration configurationWithPublishKey:@"myPublishKey"
2 subscribeKey:@"mySubscribeKey"];
3
4pnconfig.uuid = "theClientUUID"
5pnconfig.TLSEnabled = NO; // default YES
6self.client = [PubNub clientWithConfiguration:pnconfig];
1PNConfiguration.Builder configBuilder = PNConfiguration.builder(new UserId("yourUserId"), "yourSubscribeKey");
2configBuilder.publishKey("PublishKey");
3configBuilder.secure(false);
4PubNub pubNub = PubNub.create(configBuilder.build());
1PNConfiguration pnConfiguration = new PNConfiguration(new UserId("myUniqueUserId"));
2pnConfiguration.PublishKey = "myPublishKey";
3pnConfiguration.SubscribeKey = "mySubscribeKey";
4pnConfiguration.Secure = false; // default true
5
6Pubnub pubnub = new Pubnub(pnConfiguration);
1from pubnub.pnconfiguration import PNConfiguration
2from pubnub.pubnub import PubNub
3
4pnconfig = PNConfiguration()
5pnconfig.publish_key = "myPublishKey"
6pnconfig.subscribe_key = "mySubscribeKey"
7pnconfig.user_id = "myUserID"
8pnconfig.ssl = False # default True
9
10pubnub = PubNub(pnconfig)
When to disable TLS
Disable TLS only for capturing TCP traffic (for example, a tcpdump to a .pcap file) to analyze and debug network communication issues in a development environment. Re-enable TLS before deploying to production.
Related pages
- Data security and encryption. How TLS and content encryption work together.