# I can't disconnect FME to reject publishing

**URL:** <https://community.wowza.com/t/i-cant-disconnect-fme-to-reject-publishing/45276>\
**Category:** Wowza Streaming Engine\
**Created:** [June 24, 2015, 7:52pm UTC](https://community.wowza.com/t/i-cant-disconnect-fme-to-reject-publishing/45276 "2015-06-24T19:52:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryota\_Hori](https://avatars.discourse-cdn.com/v4/letter/r/df788c/32.png) [@Ryota\_Hori](https://community.wowza.com/u/Ryota_Hori)\
**Post date:** [June 24, 2015, 7:52pm UTC](https://community.wowza.com/t/i-cant-disconnect-fme-to-reject-publishing/45276/1 "2015-06-24T19:52:52Z")

</div>

Using Flash Media Live Encoder, I can’t disconnect FME to reject publishing.

Like the following

My code

```auto
public class MyModule extends ModuleCore implements IModuleOnApp2, IModuleOnConnect, IModuleOnStream {
   
    public static void publish(IClient iClient, RequestFunction requestFunction, AMFDataList amfDataList) {
        sendClientOnStatusError(iClient, "NetStream.Publish.Rejected", "Rejected");
        iClient.setShutdownClient(true);
    }
    /*
        ~~~~~~~~~~~~~~~
        ~~~~~~~~~~~~~~~
    */
}

```

Log

```auto
Wed Jun 24 2015 19:35:08 : Primary - Network Status: NetStream.Publish.Rejected error Rejected
Wed Jun 24 2015 19:35:08 : Primary - Network Status: NetConnection.Connect.Closed status
Wed Jun 24 2015 19:35:17 : Primary - Disconnected
Wed Jun 24 2015 19:35:18 : Problem publishing at Primary Server. Unable to publish STREAM_NAME stream either due to Network Problem at server, the stream name being used is busy, or you are not authorized to publish to this server. Please check the network connection with server, try publishing with other stream name, or contact your FMS administrator for help.

```

Why am I unable to disconnect immediately?

---

<div class="post-metadata">

**Author:** ![Matt\_Young](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/matt_young/32/389_2.png) [@Matt\_Young](https://community.wowza.com/u/Matt_Young)\
**Post date:** [June 24, 2015, 10:49am UTC](https://community.wowza.com/t/i-cant-disconnect-fme-to-reject-publishing/45276/2 "2015-06-24T10:49:07Z")

</div>

Hello

I’m not sure of the context by which you are attempting to reject the stream, but to obtain a more immediate response to the rejection you might try something similar to the following combination:

```auto
sendClientOnStatusError(stream.getClient(), "NetStream.Publish.Rejected", "Stream Rejected");
stream.getClient().rejectConnection();
stream.getClient().setAcceptConnectionDescription("[AccessManager.Reject] : [authmod=adobe] : ?reason=authfailed");
stream.getClient().setSendCloseOnRejectConnection(true);

```

This resulted in the following in my tests almost immediately:

```auto
Wed Jun 24 2015 11:47:34 : Primary - Network Command: onFCUnpublish
Wed Jun 24 2015 11:47:34 : Primary - Stream[test] Status: NetStream.Unpublish.Success
Wed Jun 24 2015 11:47:34 : Primary - Network Status: NetConnection.Connect.Closed status
Wed Jun 24 2015 11:47:34 : Primary - Disconnected
Wed Jun 24 2015 11:47:43 : Audio Encoding Stopped
Wed Jun 24 2015 11:47:43 : Session Stopped

```

Thanks,

Matt

---

<div class="post-metadata">

**Author:** ![Ryota\_Hori](https://avatars.discourse-cdn.com/v4/letter/r/df788c/32.png) [@Ryota\_Hori](https://community.wowza.com/u/Ryota_Hori)\
**Post date:** [June 25, 2015, 9:08am UTC](https://community.wowza.com/t/i-cant-disconnect-fme-to-reject-publishing/45276/3 "2015-06-25T09:08:10Z")

</div>

Thanks, Matt.

Where do you implement your code to reject publishing?

---

<div class="post-metadata">

**Author:** ![Ryota\_Hori](https://avatars.discourse-cdn.com/v4/letter/r/df788c/32.png) [@Ryota\_Hori](https://community.wowza.com/u/Ryota_Hori)\
**Post date:** [June 25, 2015, 9:41am UTC](https://community.wowza.com/t/i-cant-disconnect-fme-to-reject-publishing/45276/4 "2015-06-25T09:41:02Z")

</div>

I tried this code but not changed.

```auto
public class MyModule extends ModuleCore implements IModuleOnApp2, IModuleOnConnect, IModuleOnStream {
   
    public static void publish(IClient iClient, RequestFunction requestFunction, AMFDataList amfDataList) {
        sendClientOnStatusError(iClient, "NetStream.Publish.Rejected", "Rejected");
        iClient.setShutdownClient(true);
        iClient.rejectConnection();
        iClient.setAcceptConnectionDescription("[AccessManager.Reject] : [authmod=adobe] : ?reason=authfailed");
        iClient.setSendCloseOnRejectConnection(true);
    }
    /*
        ~~~~~~~~~~~~~~~
        ~~~~~~~~~~~~~~~
    */
}

```
